随笔分类 - leetcode
摘要:``` / Source : https://oj.leetcode.com/problems/reorder list/ Given a singly linked list L: L0→L1→…→Ln 1→Ln, reorder it to: L0→Ln→L1→Ln 1→L2→Ln 2→… Yo
阅读全文
摘要:``` / Source : https://oj.leetcode.com/problems/linked list cycle ii/ Given a linked list, return the node where the cycle begins. If there is no cycl
阅读全文
摘要:``` / Source : https://oj.leetcode.com/problems/linked list cycle/ Given a linked list, determine if it has a cycle in it. Follow up: Can you solve it
阅读全文
摘要:``` import java.util.*; /** * Source : https://oj.leetcode.com/problems/word-break-ii/ * * Given a string s and a dictionary of words dict, add spaces in s to construct a sentence * where each wo...
阅读全文
摘要:``` import java.util.Arrays; import java.util.HashSet; import java.util.Set; /** * Source : https://oj.leetcode.com/problems/word-break/ * * * Given a string s and a dictionary of words dict, det...
阅读全文
摘要:``` import java.util.*; /** * * Source : https://oj.leetcode.com/problems/copy-list-with-random-pointer/ * * A linked list is given such that each node contains an additional random pointer * wh...
阅读全文
摘要:``` / Source : https://oj.leetcode.com/problems/single number ii/ Given an array of integers, every element appears three times except for one. Find t
阅读全文
摘要:``` / Source : https://oj.leetcode.com/problems/single number/ Given an array of integers, every element appears twice except for one. Find that singl
阅读全文
摘要:``` / Source : https://oj.leetcode.com/problems/candy/ There are N children standing in a line. Each child is assigned a rating value. You are giving
阅读全文
摘要:``` / Source : https://oj.leetcode.com/problems/gas station/ There are N gas stations along a circular route, where the amount of gas at station i is
阅读全文
摘要:``` import java.util.*; /** * Source : https://oj.leetcode.com/problems/clone-graph/ * * * Clone an undirected graph. Each node in the graph contains a label and a list of its neighbors. * * OJ...
阅读全文
摘要:``` import java.util.ArrayList; import java.util.Arrays; import java.util.List; /** * Source : https://oj.leetcode.com/problems/palindrome-partitioning/ * * * Given a string s, partition s such t...
阅读全文
摘要:``` import java.util.Arrays; /** * * Source : https://oj.leetcode.com/problems/palindrome-partitioning-ii/ * * Given a string s, partition s such that every substring of the partition is a palind...
阅读全文
摘要:``` import java.util.Arrays; import java.util.Stack; / Source : https://oj.leetcode.com/problems/surrounded regions/ Given a 2D board containing 'X' a
阅读全文
摘要:``` import java.util.Stack; / Source : https://oj.leetcode.com/problems/sum root to leaf numbers/ Given a binary tree containing digits from 0 9 only,
阅读全文
摘要:``` import java.util.HashSet; import java.util.Set; / Source : https://oj.leetcode.com/problems/longest consecutive sequence/ Given an unsorted array
阅读全文
摘要:``` import java.util.*; /** * Source : https://oj.leetcode.com/problems/word-ladder-ii/ * * * Given two words (start and end), and a dictionary, find all shortest transformation * sequence(s) fr...
阅读全文
摘要:``` import java.util. ; / Source : https://oj.leetcode.com/problems/word ladder/ Given two words (start and end), and a dictionary, find the length of
阅读全文
摘要:``` / Source : https://oj.leetcode.com/problems/valid palindrome/ Given a string, determine if it is a palindrome, considering only alphanumeric chara
阅读全文
摘要:``` / Source : https://oj.leetcode.com/problems/binary tree maximum path sum/ Given a binary tree, find the maximum path sum. The path may start and e
阅读全文