Engineering Full Stack Apps with Java and JavaScript
Write an algorithm to reverse a string.
Assumptions
You cannot use any library functions.
You may use charAt (if needed.)
Write an algorithm to find out if a string has all unique characters.
Assumptions
You cannot use additional data structures.
References
Given two strings, write an algorithm to find if one string is a permutation of the other.
Definitions
permutation (or anagram) denote two strings that have same characters (with same numbers), but in different order.
Example
LISTEN and SILENT (have same characters, but in different order).
Write an algorithm for string compression using counts of repeated characters
Example
aaaaarrrrbbb will become a5r4b3
Assumptions
if the new compressed string is is bigger than the original string, return original string.
Write an algorithm to find if one word is a substring of other.
Example:
bcd is a substring of abcde
def is not a substring of abcde
Assumptions
You should not use any Java library functions such as contains, but may use charAt alone (if needed).
Using the above algorithm alone (isSubstring), find if one string is a rotation of other.
Example
datastructures is a rotation of astructuresdat.
cdeab is a rotation of abcde
cdaeb is not a rotation of abcde.