摘要:
Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinctnumbers from the original list. Example 1: Input: 1->2- 阅读全文
随笔档案-2019年04月
[LeetCode] 83. Remove Duplicates from Sorted List_Easy tag: Linked List
2019-04-30 10:35 by Johnson_强生仔仔, 212 阅读, 收藏, 编辑
摘要:
Given a sorted linked list, delete all duplicates such that each element appear only once. Example 1: Input: 1->1->2 Output: 1->2 Example 2: Input: 1- 阅读全文
[LeetCode] 206. Reverse Linked List_Easy tag: Linked List
2019-04-30 03:14 by Johnson_强生仔仔, 213 阅读, 收藏, 编辑
摘要:
Reverse a singly linked list. Example: Follow up: A linked list can be reversed either iteratively or recursively. Could you implement both? 很基本的一道换顺序 阅读全文
[LeetCode] 系统刷题6_Linked List
2019-04-30 01:07 by Johnson_强生仔仔, 293 阅读, 收藏, 编辑
摘要:
1. Dummy Node [LeetCode] 83. Remove Duplicates from Sorted List_Easy tag: Linked List [LeetCode] 82. Remove Duplicates from Sorted List II_Medium tag: 阅读全文
[LeetCode] 系统刷题5_Dynamic Programming
2019-04-30 00:06 by Johnson_强生仔仔, 328 阅读, 收藏, 编辑
摘要:
Dynamic Programming 实际上是[LeetCode] 系统刷题4_Binary Tree & Divide and Conquer的基础上,加上记忆化的过程。就是说,如果这个题目实际上是类似于Divide and conquer或者说是DFS,但是在计算过程中有很多重复计算同样的过程 阅读全文
[LeetCode] 97. Interleaving String_ Hard tag: Dynamic Programming
2019-04-29 11:54 by Johnson_强生仔仔, 231 阅读, 收藏, 编辑
摘要:
Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2. Example 1: Input: s1 = "aabcc", s2 = "dbbca", s3 = "aadbbcbcac" Output: 阅读全文
[LeetCode] 115. Distinct Subsequences_ Hard tag: Dynamic Programming
2019-04-28 11:21 by Johnson_强生仔仔, 247 阅读, 收藏, 编辑
摘要:
Given a string S and a string T, count the number of distinct subsequences of S which equals T. A subsequence of a string is a new string which is for 阅读全文
[LeetCode] 1143. Longest common subsequences_ Medium tag: Dynamic Programming
2019-04-28 02:27 by Johnson_强生仔仔, 268 阅读, 收藏, 编辑
摘要:
Given two strings, find the longest common subsequence (LCS). Example Example 1: Input: "ABCD" and "EDCA" Output: 1 Explanation: LCS is 'A' or 'D' or 阅读全文
[LeetCode] 139. Word Break_ Medium tag: Dynamic Programming
2019-04-26 11:08 by Johnson_强生仔仔, 461 阅读, 收藏, 编辑
摘要:
Given a non-empty string s and a dictionary wordDict containing a list of non-empty words, determine if s can be segmented into a space-separated sequ 阅读全文
[LeetCode] 132. Palindrome Partitioning II_ Hard tag: Dynamic Programming
2019-04-25 11:14 by Johnson_强生仔仔, 297 阅读, 收藏, 编辑
摘要:
Given a string s, partition s such that every substring of the partition is a palindrome. Return the minimum cuts needed for a palindrome partitioning 阅读全文
[LeetCode] 45. Jump Game II_ Hard tag: Dynamic Programming, Greedy
2019-04-24 10:41 by Johnson_强生仔仔, 261 阅读, 收藏, 编辑
摘要:
Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represents your maxim 阅读全文
[LeetCode] 55. Jump Game_ Medium tag: Dynamic Programming
2019-04-24 10:35 by Johnson_强生仔仔, 328 阅读, 收藏, 编辑
摘要:
Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represents your maxim 阅读全文
[LeetCode] 70. Climbing Stairs_ Easy tag: Dynamic Programming
2019-04-23 09:59 by Johnson_强生仔仔, 251 阅读, 收藏, 编辑
摘要:
You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you cl 阅读全文
[LeetCode] 63. Unique Paths II_ Medium tag: Dynamic Programming
2019-04-23 09:36 by Johnson_强生仔仔, 263 阅读, 收藏, 编辑
摘要:
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 move either down or right at any p 阅读全文
[LeetCode] 120. Triangle _Medium tag: Dynamic Programming
2019-04-22 04:24 by Johnson_强生仔仔, 223 阅读, 收藏, 编辑
摘要:
Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below. For example, given the fo 阅读全文
[LeetCode] 236. Lowest Common Ancestor of a Binary Tree_ Medium tag: DFS, Divide and conquer
2019-04-19 06:07 by Johnson_强生仔仔, 252 阅读, 收藏, 编辑
摘要:
Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree. According to the definition of LCA on Wikipedia: “The lowes 阅读全文
[LeetCode] 系统刷题4_Binary Tree & Divide and Conquer
2019-04-18 09:14 by Johnson_强生仔仔, 335 阅读, 收藏, 编辑
摘要:
The most important : [LeetCode] questions conclustion_BFS, DFS 参考[LeetCode] questions conlusion_InOrder, PreOrder, PostOrder traversal 可以对binary tree进 阅读全文
[LeetCode] 702. Search in a Sorted Array of Unknown Size_Medium tag: Binary Search
2019-04-17 10:00 by Johnson_强生仔仔, 4 阅读, 收藏, 编辑
该文被密码保护。 阅读全文
[LeetCode] 系统刷题2_Binary search
2019-04-16 10:27 by Johnson_强生仔仔, 257 阅读, 收藏, 编辑
摘要:
可以参考 [LeetCode] questions conclusion_ Binary Search 阅读全文
[LeetCode] 33. Search in Rotated Sorted Array_Medium tag: Binary Search
2019-04-16 10:26 by Johnson_强生仔仔, 193 阅读, 收藏, 编辑
摘要:
Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. (i.e., [0,1,2,4,5,6,7] might become [4,5,6,7,0,1,2]). Y 阅读全文
[LeetCode] 系统刷题3_排列组合/backtracking
2019-04-11 10:23 by Johnson_强生仔仔, 318 阅读, 收藏, 编辑
摘要:
适用范围: 几乎所有搜索问题 什么时候输出 哪些情况需要跳过 Python library import itertools itertools.product('ABC', repeat = 2) 3 * 3 = 9 list(itertools.product('ABC', repeat = 2 阅读全文
[LeetCode] 90.Subsets II tag: backtracking
2019-04-11 10:21 by Johnson_强生仔仔, 263 阅读, 收藏, 编辑
摘要:
Given a collection of integers that might contain duplicates, nums, return all possible subsets (the power set). Note: The solution set must not conta 阅读全文
[JavaScript] Frequently used method or solutions for issues
2019-04-03 02:09 by Johnson_强生仔仔, 228 阅读, 收藏, 编辑
摘要:
Get the file name from the file path Solution: 阅读全文
[CSS] Frequently used method or solutions for issues
2019-04-01 22:47 by Johnson_强生仔仔, 298 阅读, 收藏, 编辑
摘要:
Stick button in right side in html Solution: Set the size of textarea in CSS. Solution: Set the item at the top besides the textarea set font like thi 阅读全文