随笔分类 -  LeetCode解题

上一页 1 2 3 4 5 6 下一页
130. Surrounded Regions 解题记录
摘要:题目描述: Given a 2D board containing 'X' and 'O' (the letter O), capture all regions surrounded by 'X'. A region is captured by flipping all 'O's into 'X 阅读全文
posted @ 2018-03-29 11:13 宵夜在哪 阅读(110) 评论(0) 推荐(0)
129. Sum Root to Leaf Numbers 解题记录
摘要:Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number. An example is the root-to-leaf path 1->2->3 whic 阅读全文
posted @ 2018-03-28 17:09 宵夜在哪 阅读(115) 评论(0) 推荐(0)
120. 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 阅读全文
posted @ 2018-03-26 09:10 宵夜在哪 阅读(117) 评论(0) 推荐(0)
113. Path Sum II 解题记录
摘要:题目描述: Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum. For example: Given the below binary tree 阅读全文
posted @ 2018-03-25 23:26 宵夜在哪 阅读(86) 评论(0) 推荐(0)
102. Binary Tree Level Order Traversal 解题记录
摘要:题目描述: Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level). For example: Given binary 阅读全文
posted @ 2018-03-24 22:11 宵夜在哪 阅读(95) 评论(0) 推荐(0)
94. Binary Tree Inorder Traversal 解题记录
摘要:题目描述: Given a binary tree, return the inorder traversal of its nodes' values. For example: Given binary tree [1,null,2,3], return [1,3,2]. Note: Recur 阅读全文
posted @ 2018-03-23 22:23 宵夜在哪 阅读(85) 评论(0) 推荐(0)
90. Subsets II 解题记录
摘要:题目描述: Given a collection of integers that might contain duplicates, nums, return all possible subsets (the power set). Note: The solution set must not 阅读全文
posted @ 2018-03-22 11:42 宵夜在哪 阅读(99) 评论(0) 推荐(0)
89. Gray Code 解题记录
摘要:题目描述: The gray code is a binary numeral system where two successive values differ in only one bit. Given a non-negative integer n representing the tot 阅读全文
posted @ 2018-03-21 19:23 宵夜在哪 阅读(131) 评论(0) 推荐(0)
运算符重载
摘要:基本概念: 对已有的运算符赋予多重的含义 使同一运算符作用于不同类型的数据时,有不同类型的行为 目的是扩展C++中提供的运算符的适用范围,以用于类所表示的抽象数据类型 运算符重载的实质是函数重载: 返回值类型 operator 运算符(形参表) { } 可重载为普通函数和成员函数,成员函数的形参中因 阅读全文
posted @ 2018-03-20 17:54 宵夜在哪 阅读(153) 评论(0) 推荐(0)
86. 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 preserv 阅读全文
posted @ 2018-03-20 17:14 宵夜在哪 阅读(78) 评论(0) 推荐(0)
82. Remove Duplicates from Sorted List II 解题记录
摘要:题目描述: Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list. For example, Giv 阅读全文
posted @ 2018-03-19 18:01 宵夜在哪 阅读(83) 评论(0) 推荐(0)
81. Search in Rotated Sorted Array II 解题记录
摘要:题目描述: 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). 阅读全文
posted @ 2018-03-18 22:15 宵夜在哪 阅读(62) 评论(0) 推荐(0)
80. Remove Duplicates from Sorted Array II 解题记录
摘要:题目描述: Follow up for "Remove Duplicates": What if duplicates are allowed at most twice? For example, Given sorted array nums = [1,1,1,2,2,3], Your func 阅读全文
posted @ 2018-03-17 13:27 宵夜在哪 阅读(86) 评论(0) 推荐(0)
79. 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 sequentially adjacent cell, where 阅读全文
posted @ 2018-03-16 20:10 宵夜在哪 阅读(118) 评论(0) 推荐(0)
78. Subsets 解题记录
摘要:题目描述: Given a set of distinct integers, nums, return all possible subsets (the power set). Note: The solution set must not contain duplicate subsets. 阅读全文
posted @ 2018-03-15 18:21 宵夜在哪 阅读(133) 评论(0) 推荐(0)
56. Merge Intervals 解题记录
摘要:题目描述: Given a collection of intervals, merge all overlapping intervals. For example, Given [1,3],[2,6],[8,10],[15,18], return [1,6],[8,10],[15,18]. 解题 阅读全文
posted @ 2018-03-14 18:44 宵夜在哪 阅读(108) 评论(0) 推荐(0)
77. Combinations 解题记录
摘要:题目描述: Given two integers n and k, return all possible combinations of k numbers out of 1 ... n. For example, If n = 4 and k = 2, a solution is: 解题思路: 阅读全文
posted @ 2018-03-13 17:37 宵夜在哪 阅读(123) 评论(0) 推荐(0)
75. Sort Colors 解题记录
摘要:题目描述: Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order 阅读全文
posted @ 2018-03-12 13:08 宵夜在哪 阅读(107) 评论(0) 推荐(0)
73. 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. Follow up: Did you use extra space? A straight for 阅读全文
posted @ 2018-03-12 00:45 宵夜在哪 阅读(93) 评论(0) 推荐(0)
64. Minimum Path Sum 解题记录
摘要:题目描述: Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its 阅读全文
posted @ 2018-03-10 14:07 宵夜在哪 阅读(95) 评论(0) 推荐(0)

上一页 1 2 3 4 5 6 下一页