Heads Up: Sorry for the scuffed explanations, I couldn't solve both so I'm trying to explain sth idk.
Q1:
Given string S of 0's and 1's and X find the longest subsequence of S that would make up a number less than X when converted to its binary equivalent.
S="110110101"
X=40
100101 = 37 -> length = 6
Q2:
Given 2 arrays and their lengths, get the subsequence that maximizes the following: max of every sequence in the subsequence - min of every sequence in the subsequence