Ascii subsequences@cant understand the order in which we hv to print the ans

https://hack.codingblocks.com/contests/c/512/355

https://ide.codingblocks.com/s/51855

when i try to print , i dont get the ans in right order even after i use map.

1.Either you can print the string as it is.
2. or you can add the next character.
3. or you can add the ascii value.
In this order you have to print also don’t add endl after printing every string put space as given in output format.
Also calculate total number of combinations formed.
https://ide.codingblocks.com/s/51869

1 Like

yaa , i got it after some time. thank you.

one more qn== is to_string itos(int )ch is an inbuilt fn to convert integer to string?

in this qn i hv used the optimised approach but still it is showing tle in 2 test cases.

You can do this in O(N2) by simply applying two for loop.
But try to do to this question in O(N+M) ,try to find the use of sorted row and column.

1 Like

i did, plz see the code. in the worst case it will take o(n+m) iterations.

https://ide.codingblocks.com/s/52060 I have rectified your code but this is O(N * M) only and not O(N+M).

1 Like

https://ide.codingblocks.com/s/52055 check this code .

1 Like