Categories
LeetCode

LeetCode 355. Design Twitter

Source: https://leetcode.com/problems/design-twitter/

Design a simplified version of Twitter where users can post tweets, follow/unfollow another user and is able to see the 10 most recent tweets in the user’s news feed. Your design should support the following methods:

Categories
LeetCode

LeetCode 350. Intersection of Two Arrays II

Source: https://leetcode.com/problems/intersection-of-two-arrays-ii/

Given two arrays, write a function to compute their intersection.

Categories
LeetCode

LeetCode 349. Intersection of Two Arrays

Source: https://leetcode.com/problems/intersection-of-two-arrays/

Given two arrays, write a function to compute their intersection.

Categories
LeetCode

LeetCode 347. Top K Frequent Elements

Source: https://leetcode.com/problems/top-k-frequent-elements/

Given a non-empty array of integers, return the k most frequent elements.

Categories
LeetCode

LeetCode 299. Bulls and Cows

Source: https://leetcode.com/problems/bulls-and-cows/

You are playing the following Bulls and Cows game with your friend: You write down a number and ask your friend to guess what the number is. Each time your friend makes a guess, you provide a hint that indicates how many digits in said guess match your secret number exactly in both digit and position (called “bulls”) and how many digits match the secret number but locate in the wrong position (called “cows”). Your friend will use successive guesses and hints to eventually derive the secret number.

Categories
LeetCode

LeetCode 290. Word Pattern

Source:https://leetcode.com/problems/word-pattern/

Given a pattern and a string str, find if str follows the same pattern.

Here follow means a full match, such that there is a bijection between a letter in pattern and a non-empty word in str.

Categories
LeetCode

LeetCode 219. Contains Duplicate II

Source: https://leetcode.com/problems/contains-duplicate-ii/

Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nums[i] = nums[j]and the absolute difference between i and j is at most k.

Categories
LeetCode

LeetCode 217. Contains Duplicate

Source: https://leetcode.com/problems/contains-duplicate/

Categories
LeetCode

LeetCode 205. Isomorphic Strings

Given two strings s and t, determine if they are isomorphic.

Categories
LeetCode

LeetCode 202. Happy Number

Source:https://leetcode.com/problems/happy-number/

Write an algorithm to determine if a number is “happy”.