原创 LeetCode Unique Paths
A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). The robot can only m
原创 LeetCode Spiral Matrix II
Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order. For example, Given n
原创 LeetCode Spiral Matrix
Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order. For example
原创 LeetCode Set Matrix Zeroes
Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place. click to show follow u
原创 LeetCode Triangle
Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row
原创 LeetCode Word Search
Given a 2D board and a word, find if the word exists in the grid. The word can be constructed from letters of seq
原创 LeetCode Subsets II
Given a collection of integers that might contain duplicates, S, return all possible subsets. Note: Elements in a su
原创 LeetCode Sort Colors
Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, w
原创 LeetCode Subsets
Given a set of distinct integers, S, return all possible subsets. Note: Elements in a subset must be in non-descendin
原创 LeetCode Plus One
Given a non-negative number represented as an array of digits, plus one to the number. The digits are stored such th
原创 LeetCode Sort List
Sort a linked list in O(n log n) time using constant space complexity. class ListNode { int val; ListNode next
原创 java數據結構 哈希表
哈希表HashTable提供了快速插入、查找的操作。基於數組實現 (key,value)形式存儲 如果key是int型,可以直接根據key值作爲數組下標 arr[key]; 如果key是字符串,需要編寫hashCode函數返回int值 1
原创 LeetCode Minimum Window Substring
Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexit
原创 java數據結構 二叉樹
有序數組:插入、刪除數據項慢 鏈表:查找慢 樹:查找、插入、刪除都快 /* * 二叉樹結點 */ public class Node { //數據項 public long data; public String sDate;
原创 java數據結構 HashTable鏈地址法
鏈地址法:哈希表每個單元設置爲鏈表,當關鍵字通過hashCode映射到哈希表單元中,將數據本身插入到該單元的鏈表中 數據結構層次:Info->Node->LinkList->HashTable 1、Node類 /* * 鏈結點 */