Given a sequence S of N digits find a subsequence of k digits such that the number formed by these by k digits is the largest.
S = String, of length N, N can be huge.....
K = Integer;
res = String;
Example1:
S = "236468284802029302282"
K = 2
Res = 98
Example2:
S = "2364682848020293022821"
K = 4
Res = 9821
I used backtracking apporach I was wondering, if anyone has any better/optimized idea would love to learn that.