wisdompeak / LeetCode

This repository contains the solutions and explanations to the algorithm problems on LeetCode. Only medium or above are included. All are written in C++/Python and implemented by myself. The problems attempted multiple times are labelled with hyperlinks.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

805题第二种做法

yuanlu0210 opened this issue · comments

805题第二种做法 805.Split-Array-With-Same-Average_DP2.cpp 好像没有考虑到全零并且长度大于1的test case,比如[0, 0, 0, 0, 0],在第20行if (sum*n%total!=0) continue;处会出现division by zero的错误。

Updated. Add pre-check:

if (total==0) return true;