Close

Check if a string is a double string

Given a string, we need to check if a string is a double string possibly by deleting a character. A double string is a repetition of two strings affixed together. For example the following strings are double strings “aa”, “meme”, “abbabb” Where as the follwing are not double strings “ab”, “abc”, “acbab” However “acbab” can…

Decreasing string

Given a number K, Find the shortest and smallest string  which has K positions in it, such that the character at that position is alphabetically greater than the character immediately after it. Only the lower case alphabets [a-z] are allowed. For example consider K = 1 “ba” is the shortest and smallest string possible. There…

Up down array

Given an array of numbers A[N], how do we arrange them in the following order. A[0] <= A[1] >= A[2] <= A[3]…A[N-1] For example consider the array A =[6, 9, 36, 24, 42] The answer can be [6, 36, 9, 42, 24]. There can be multiple answers also like [6, 42, 9, 36, 24]. We…