3388. Count Beautiful Splits in an Array (Leetcode Medium)

  Рет қаралды 711

Programming Live with Larry

Programming Live with Larry

Күн бұрын

Пікірлер: 6
@Algorithmist
@Algorithmist 7 күн бұрын
Did you do a good split on this?
@minhdang5132
@minhdang5132 23 сағат бұрын
My solution: DP + Rolling hash got TLE in Python :
@bufdud4
@bufdud4 3 күн бұрын
Your python code still accepts, and actually faster than 70%...
@Krishnakantydv
@Krishnakantydv 6 күн бұрын
i tried this N2 solutoin, 530 test case passes, it fails for input; [0,0,0,0,2,2,0,1,2,1,2], expected is 19, but my soluton returns 18. I cant even see the 19th split manually. Here is the code: class Solution { public: int beautifulSplits(vector& nums) { int n = nums.size(), count = 0; string total = ""; for (int i = 0; i < n; i++) { total += to_string(nums[i]); } for (int i = 0; i < n - 2; i++) { string str1 = total.substr(0, i + 1); // Check for match in the first intersection if (i 0) { count += k; } continue; // No need to check second joint for this `i` } } // Check for match in the second joint for (int size = 1; size
@Algorithmist
@Algorithmist 5 күн бұрын
for small inputs, just run an N^3 solution and then compare your solution to it - so basically you are writing a verifier to help yourself debug
3387. Maximize Amount After Two Days of Conversions (Leetcode Medium)
13:02
Programming Live with Larry
Рет қаралды 556
2182. Construct String With Repeat Limit - Day 17/31 Leetcode December Challenge
22:31
The evil clown plays a prank on the angel
00:39
超人夫妇
Рет қаралды 53 МЛН
3389. Minimum Operations to Make Character Frequencies Equal (Leetcode Hard)
42:24
Programming Live with Larry
Рет қаралды 345
2024's Biggest Breakthroughs in Math
15:13
Quanta Magazine
Рет қаралды 453 М.
2981. Find Longest Special Substring That Occurs Thrice I
20:30
bab lobko (Short and straight to the point)
Рет қаралды 9
3399. Smallest Substring With Identical Characters II (Leetcode Hard)
1:03:05
Programming Live with Larry
Рет қаралды 97
How I would learn Leetcode if I could start over
18:03
NeetCodeIO
Рет қаралды 730 М.
Making an Algorithm Faster
30:08
NeetCodeIO
Рет қаралды 176 М.
Jump Game - Greedy - Leetcode 55
16:28
NeetCode
Рет қаралды 261 М.
The LeetCode Fallacy
6:08
NeetCode
Рет қаралды 590 М.
LeetCode: The Worst Thing to Happen to Software Engineering
8:03
Coding with Dee
Рет қаралды 150 М.
The evil clown plays a prank on the angel
00:39
超人夫妇
Рет қаралды 53 МЛН