hello people
Day 2 wasnt that productive of a day tbh, i struggled in waking up early, ended up waking at 9 took entire day to just solve 5 problems ended up seeing there solutions but its all good i guess , u dont always go up along the graph i guess
the problems i looked upon yesterday were
1.splitting binary string into two diff strings containing 0 and 1 individually it was a rather easy question i overthought about this ngl
2. the second was edit distance it was an easy question we had to convert one string into another using insert remove replace we had to do so in the minimum of operations. I knew the recursive approach but to opitmise the solution we used the dynamic programming approach basically try out all the combs.
3. finding next greater number in the sets of digit it can be solved using stl s next_permutation also but the logic how ever is simple find the first decreasing element from the end ,store its index as j and then from j to n find the smallest number u encounter which is to be swapped with the j th number and then sort the array from j+1 to n.
4. balanced parenthesis problem was very simple but the use of stack was rather impressive , store opening brackets in stack , if u encounter close brackets and it doesnt match with the last bracket or last element , return false.
I do have my self doubts with me but I for sure know i m not gonna give up , i ll take this is as a challenge and make things happen!. over and out
Comments
Post a Comment