原题地址:https://oj.leetcode.com/problems/partition-list/ 题意: Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x. You should preserve the original relative order of the nodes in ea…
题目来源 https://leetcode.com/problems/partition-list/ Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x. You should preserve the original relative order of the nodes in each of t…
题目来源: https://leetcode.com/problems/palindrome-partitioning/ 题意分析: 给定一个字符串s,将s拆成若干个子字符串,使得所有的子字符串都是回文字符串,返回所有这样的子字符串集合.比如s = “aab”,那么返回[["aa","b"],["a","a","b"]]. 题目思路: 这是一个动态规划问题,如果s[:i]是回文字符串,那么s[:i] X s…
Given a non-empty array containing only positive integers, find if the array can be partitioned into two subsets such that the sum of elements in both subsets is equal. Note: Both the array size and each of the array element will not exceed 100. Exam…
Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x. You should preserve the original relative order of the nodes in each of the two partitions. For example,Given 1->4->3->2…
题目来源 https://leetcode.com/problems/valid-palindrome/ Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. For example,"A man, a plan, a canal: Panama" is a palindrome."race a car"…
题目来源 https://leetcode.com/problems/triangle/ 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 following triangle [ [], [,4], [6,,7], [4,,8,3] ] The min…
题目来源 https://leetcode.com/problems/pascals-triangle-ii/ Given an index k, return the kth row of the Pascal's triangle. For example, given k = 3,Return [1,3,3,1]. 题意分析 Input:integer Output:kth row of the Pascal's triangle Conditions:只返回第n行 题目思路 同118,不…
题目来源 https://leetcode.com/problems/pascals-triangle/ Given numRows, generate the first numRows of Pascal's triangle. For example, given numRows = 5,Return [ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1] ] 题意分析 Input:integer Output:帕斯卡三角 Conditions:帕斯卡三…
题目来源 https://leetcode.com/problems/populating-next-right-pointers-in-each-node/ Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; } Populate each next pointer to point to its next right node. If th…