Bruh you getting faster and faster everyday. So proud of your progress, I still remember early days before the website and the early videos. Keep going, you the best!
Was able to reach the solution by looking back at a solution you posted two days ago (1422. Maximum Score After Splitting a String) which worked! Just wanted to comment how your videos are so useful for learning how to not only solve the problem, but also arrive to the solution. So thank you!
class Solution: def waysToSplitArray(self, nums: List[int]) -> int: right = sum(nums) left = 0 res = 0 for i in range(len(nums) - 1): left += nums[i] right -= nums[i] res += 1 if left >= right else 0 return res
The acceptance rate is low because in strongly typed languages, you can easily fail on the last test case if you use for example an int in Java to store your sums instead of a long.
I also thought the exactly same, but isn't in the worst case of we have all positive integers in the array, and all the integers are of 10^5 size. Then how, one can hold this much bigger number even in long datatype in Java.
One question, this seems to be the most optimal solution however it is only in the top 77%, how are people achieving faster times? Is it because they are using a faster language i.e. C?
solved it myself, so NO NEETCODE FOR TODAY BABY!🥳🥳🥳 See u all tomorrow
Me too!
same thank you neetcode daddy
me to!
🤨
same here
i got 92/101 testcases, so here i am for neetcode
Bruh you getting faster and faster everyday. So proud of your progress, I still remember early days before the website and the early videos.
Keep going, you the best!
Acceptance rate is less here because we need to use long instead of int. So most of them will submit atleast twice and the succes rate is 50%.
Oh that makes sense.
Oh wow I did it using a prefix sum and a suffix sum array and comparing them to find the answer
Me too 🙂, prolly because we used it on a previous leetcode problem recently.... so it automatically popped up in our heads
This was a problem where I found the exact same solution as you on my own, although it was on the easier end of problems. Thank you NeetCode.
Man, this guy is the goat. Rapid upload speed.
And yeah, this problem was kinda easy, felt weird for a "medium"
The devil works hard but bro works harder 🤣
Thank you for being such a motivational figure 💗
Was able to reach the solution by looking back at a solution you posted two days ago (1422. Maximum Score After Splitting a String) which worked!
Just wanted to comment how your videos are so useful for learning how to not only solve the problem, but also arrive to the solution. So thank you!
class Solution:
def waysToSplitArray(self, nums: List[int]) -> int:
right = sum(nums)
left = 0
res = 0
for i in range(len(nums) - 1):
left += nums[i]
right -= nums[i]
res += 1 if left >= right else 0
return res
Solved it myself. I can almost solve medium problems now
Already solved it but here to see my bro neetcode solve it.
From my observation, acceptance rate is more relevant to the completeness of default test cases rather than actual difficulty.
Excellent explanation. Thank you :)
The acceptance rate is low because in strongly typed languages, you can easily fail on the last test case if you use for example an int in Java to store your sums instead of a long.
Well Explained Code !!
Keep up the good work
Slick explanation!
I also thought the exactly same, but isn't in the worst case of we have all positive integers in the array, and all the integers are of 10^5 size. Then how, one can hold this much bigger number even in long datatype in Java.
One question, this seems to be the most optimal solution however it is only in the top 77%, how are people achieving faster times? Is it because they are using a faster language i.e. C?
I used both Prefix sum Array and Suffix sum iteratvely from backwards to 1 index and checked for condition where my sufffixsum
Valtteri, it's James!
-1 + -8 = +7?
got it. we added -8 on lhs and +8 on rhs
yaa i am a mad person , i did it with dp
count = 0
left, right = nums[0], sum(nums[1:])
for i in range(1,len(nums)):
if left >= right:
count += 1
right -= nums[i]
left += nums[i]
return count