Common Array & String Problems

Arrays and strings are regularly featured in coding interviews and programming problems. Below are many of the common problems you need to master with explanations.

Array Problems

String Problems

Sample Problem: Move Zeroes (Array)

def moveZeroes(nums):
    j = 0  # index for placing non-zero
    for i in range(len(nums)):
        if nums[i] != 0:
            nums[j] = nums[i]
            if i != j:
                nums[i] = 0
            j += 1

Sample Problem: Check Palindrome (String)

def isPalindrome(s):
    return s == s[::-1]

Tips for Problem Solving: