[LeetCode] 75. Sort Colors Given an array nums with n objects colored red, white, or blue, sort them in-place so that objects of the same color are adjacent, with the colors in the order red, white, and blue. We will use the in 2019-10-17 #leetcode #java #javascript #array #two pointer #quick sort
[LeetCode] 191. Number of 1 Bits Write a function that takes an unsigned integer and returns the number of ‘1’ bits it has (also known as the Hamming weight). Note:Note that in some languages, such as Java, there is no unsigned integ 2019-10-15 #leetcode #java #javascript #bit manipulation
[LeetCode] 206. Reverse Linked List Given the head of a singly linked list, reverse the list, and return the reversed list. Example 1:Input: head = [1,2,3,4,5]Output: [5,4,3,2,1] Example 2:Input: head = [1,2]Output: [2,1] Exam 2019-10-14 #leetcode #java #recursion #linked list
[LeetCode] 202. Happy Number Write an algorithm to determine if a number n is happy. A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of the squares of 2019-10-14 #leetcode #java #javascript #hashmap #math
[LeetCode] 2. Add Two Numbers You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order, and each of their nodes contains a single digit. Add the two numbers and return 2019-10-13 #leetcode #java #javascript #linked list
[LeetCode] 20. Valid Parentheses Given a string s containing just the characters ‘(‘, ‘)’, ‘{‘, ‘}’, ‘[‘ and ‘]’, determine if the input string is valid. An input string is valid if:Open brackets must be closed by the same type of br 2019-10-11
[LeetCode] 242. Valid Anagram Given two strings s and t, return true if t is an anagram of s, and false otherwise. An Anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all 2019-10-10 #leetcode #java #javascript #array #counting sort
[LeetCode] 128. Longest Consecutive Sequence Given an unsorted array of integers nums, return the length of the longest consecutive elements sequence. You must write an algorithm that runs in O(n) time. Example 1:Input: nums = [100,4,200,1, 2019-10-09 #leetcode #java #javascript #array #hashmap #LIS
[LeetCode] 334. Increasing Triplet Subsequence Given an integer array nums, return true if there exists a triple of indices (i, j, k) such that i < j < k and nums[i] < nums[j] < nums[k]. If no such indices exists, return false. Example 2019-10-09 #leetcode #java #javascript #array #LIS #selection sort
[LeetCode] 7. Reverse Integer Given a signed 32-bit integer x, return x with its digits reversed. If reversing x causes the value to go outside the signed 32-bit integer range [-231, 231 - 1], then return 0. Assume the environment 2019-10-09 #leetcode #java #javascript #math