#Alpha Camp Week 1 Exercise Summary
-
Exercise 4: Valid Anagram: Given two strings s and t, write a function to determine if t is an anagram of s.
-
Exercise 5: Majority Element: Given an array of size n, find the majority element. The majority element is the element that appears more than โ n/2 โ times.
-
Exercise 6: Remove Duplicates from Sorted Array: Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.
-
Exercise 7: Ugly Number: Write a program to check whether a given number is an ugly number. Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example, 6, 8 are ugly while 14 is not ugly since it includes another prime factor 7.
-
Exercise 8: Single Number 2: Given an array of integers, every element appears three times except for one, which appears exactly once. Find that single one.
-
Exercise 9: Best Time to Buy and Sell Stock II: An algorithm to find the maximum profit
-
Exercise 10: Search Insert Position: A sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.