Remember everything about Data Structures and Algorithms
1 min
Article
Algorithm
Table of Contents
Major concepts and common patterns
Arrays
To find a palindrome: Compare the given string with length of the reversed string
To find duplicates: Put the given numbers in set, then check if the len of the set is equal to len of the given array. If not equal then there are duplicates.
The answer here is Boolean.
For Anagrams: Sort them both, check if they are equal, return bool