Split Binary String Chintu has a long binary string ‘str’. A binary string is a string that contains only 0 and 1. He considers a string ‘beautiful’ if and only if the number of 0's and 1's in the string are equal. For example : 0011 , 1100 , 101010 etc are beautiful strings whereas 1110, 0001,10101 etc are not...
read more
CodingNinjas
author
2y
Approach : 1) Take two variables ‘cnt0’ and ‘cnt1’ to store the count of 0s and 1s respectively. Also, take a variable ‘cnt’ which stores the count of the number of substrings.2) Now for each i f...
see more
CodingNinjas
author
2y
Iterative approachThe key idea in solving this problem is to simply iterate through the given string and keep the count of 1s and 0s in the string. Whenever we have the count of 1 and 0 to be equal, w...
see more
Help your peers!
Add answer anonymously...
Top JPMorgan Chase & Co. Software Developer interview questions & answers
Popular interview questions of Software Developer
Top HR questions asked in JPMorgan Chase & Co. Software Developer
>
JPMorgan Chase & Co. Software Developer Interview Questions
Stay ahead in your career. Get AmbitionBox app
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+
Reviews
4 L+
Interviews
4 Cr+
Salaries
1 Cr+
Users/Month
Contribute to help millions
Get AmbitionBox app