The string may contain English alphabets, numbers, and special characters.
The first line contains a single integer ‘T’ representing the number of test cases.
The first line of each test case will contain a string ‘S’.
For each test case, return 'true' if Kevin will play with the given string. Otherwise, return 'false'.
Print the output for each test case in a separate line.
You don’t need to print anything, It has already been taken care of. Just implement the given function.
1 <= T <= 1000
1 <= |S| <= 100
Where '|S|' is the length of the given string.
Time limit: 1 sec
The basic idea is to iterate through all the array elements and check whether each character uniquely exists in the string or not.
The steps are as follows:
The basic idea of this approach is to sort the characters of the string ‘S’ in increasing order and check if there exist any duplicates, then return false. Otherwise, return true.
The steps are as follows:
The basic idea of this approach is to insert all the characters of the given string into a HashSet and then check if the size of HashSet is the same as the given string or not. If it is the same, which means there are no duplicates in the string.
The steps are as follows:
Max Prefix
Longest Subarray With Zero Sum
Merge Two Sorted Arrays Without Extra Space
Maximum GCD
Sort 0s, 1s, 2s