[LeetCode] 443. String Compression Given an array of characters chars, compress it using the following algorithm:Begin with an empty string s. For each group of consecutive repeating characters in chars:If the group’s length is 1, appe 2020-05-08 #leetcode #two pointer #java #string #simulation
[LeetCode] 704. Binary Search Given an array of integers nums which is sorted in ascending order, and an integer target, write a function to search target in nums. If target exists, then return its index. Otherwise, return -1. You 2020-04-29 #leetcode #java #javascript #binary search
[LeetCode] 221. Maximal Square Given an m x n binary matrix filled with 0’s and 1’s, find the largest square containing only 1’s and return its area. Example 1: Input: matrix = [[“1”,”0”,”1”,”0”,”0”],[“1”,”0”,”1”,”1”,”1”],[“1” 2020-04-28 #leetcode #java #matrix #dynamic programming
[LeetCode] 621. Task Scheduler You are given an array of CPU tasks, each represented by letters A to Z, and a cooling time, n. Each cycle or interval allows the completion of one task. Tasks can be completed in any order, but there 2020-04-26 #leetcode #hashmap #java #greedy #heap
[LeetCode] 18. 4Sum Given an array nums of n integers, return an array of all the unique quadruplets [nums[a], nums[b], nums[c], nums[d]] such that:0 <= a, b, c, d < na, b, c, and d are distinct.nums[a] + nums 2020-04-26 #leetcode #array #two pointer #java #javascript #two sum
[LeetCode] 36. Valid Sudoku Determine if a 9 x 9 Sudoku board is valid. Only the filled cells need to be validated according to the following rules:Each row must contain the digits 1-9 without repetition.Each column must contain 2020-04-20 #leetcode #array #hashmap #java #string
[LeetCode] 994. Rotting Oranges You are given an m x n grid where each cell can have one of three values:0 representing an empty cell,1 representing a fresh orange, or2 representing a rotten orange.Every minute, any fresh orange tha 2020-04-16 #leetcode #array #java #javascript #bfs #flood fill
[LeetCode] 78. Subsets Given an integer array nums of unique elements, return all possible subsets (the power set). The solution set must not contain duplicate subsets. Return the solution in any order. Example 1:Input: num 2020-04-16 #leetcode #array #java #backtracking
[LeetCode] 362. Design Hit Counter Design a hit counter which counts the number of hits received in the past 5 minutes. Each function accepts a timestamp parameter (in seconds granularity) and you may assume that calls are being made t 2020-04-14 #leetcode #java #design
[LeetCode] 25. Reverse Nodes in k-Group Given the head of a linked list, reverse the nodes of the list k at a time, and return the modified list. k is a positive integer and is less than or equal to the length of the linked list. If the num 2020-04-13 #leetcode #java #linked list