Given a string s, return the length of the longest substring that contains at most two distinct characters. Example 1: Input…
My memo and playground
Given a string s, return the length of the longest substring that contains at most two distinct characters. Example 1: Input…
Given an unsorted array of integers nums, return the length of the longest consecutive elements sequence. You must write an algorithm that r…
Given an integer array nums and an integer k, return true if there are two distinct indices i and j …
Write an algorithm to determine if a number n is happy. A happy number is a number defined by the following process: Return t…
Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target. You…
Given an array of strings strs, group the anagrams together. You can return the answer in any order. An Anagram is a wor…
Given two strings s and t, return true if t is an anagram of s, and false otherwise. An Anagram…
Given a pattern and a string s, find if s follows the same pattern. Here follow means a full match, such that there…
Given two strings s and t, determine if they are isomorphic. Two strings s and t are isomorphic if the charact…
Given two strings ransomNote and magazine, return true if ransomNote can be constructed by using the letters from&n…