- 博客(22)
- 收藏
- 关注
原创 LeetCode-98. Validate Binary Search Tree
DescriptionGiven a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtree of a node contains only nodes with keys less than the no...
2018-07-26 14:18:05 425
原创 C++——虚函数(virtual)
写在前面这一篇博客记录一下自己理解的虚函数的相关内容。虚函数在刚开始学习C++的时候并不理解为什么需要这个东西?现在觉得要理解这个概念,需要对面向对象编程这个软件设计模式要有了解。学习C++不光要能理解语法特征,还要明白一些常用的软件设计模式。 这篇博客我也还是会结合一些网络上的资料,加上自己的理解阐述一下对虚函数的理解。参考资料c++ 深入理解虚函数C++ 虚函数表解析对于...
2018-07-20 16:13:54 404
原创 C++——友元(friend)
写在前面这一篇博客简单的记录一下我对于友元的理解。友元可以是个函数,就称为友元函数,也可以是一个类,就称为友元类。类,(这个我还没有专门整理),具有封装信息与提供结构的特性。public可以为外部提供调用接口,private则隐藏与类相关的数据方法等,起到抽象对象的作用。所以,只有内的成员函数才能访问类的私有成员,程序中其他的函数是无法访问私有成员变量的,但是能够访问类中的公有变量或者函数。...
2018-07-11 17:18:28 535
原创 C++——回调函数
写在前面这里学习一下回调函数,主要也是参考网上的资料做一个简单的整理。参考文献:C++回调函数的一点理解C++ 使用回调函数的方式 和 作用。 持续更新示例代码#include <iostream>using namespace std;typedef void (*Func)(int);Func p = NULL;void caller(F...
2018-07-10 11:31:21 822
原创 LeetCode-394. Decode String
DescriptionGiven an encoded string, return it's decoded string.The encoding rule is: k[encoded_string], where the encoded_string inside the square brackets is being repeated exactly k times. Not...
2018-07-08 14:05:12 166
原创 HTML5——HTML5元素周期表
写在前面其实自己看了HTML5好久了,主要标签多少也都有用过了,但是呢,缺少一定的总结。看了一遍相当于再读代码不会陌生,但是只有总结才能把知识整理成自己的,相当于对于这一块知识有了头绪。HTML5元素周期表发现HTML5元素周期表,整理一下:有两个版本:中文:HTML5 标签含义之元素周期表英文:Periodic Table of the HTML5 Elements...
2018-07-07 22:40:10 6511
原创 LeetCode-46. Permutations
DescriptionGiven a collection of distinct integers, return all possible permutations.ExampleInput: [1,2,3]Output:[ [1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2], [3,2,1]]Sol...
2018-07-07 20:35:53 252
原创 LeetCode-322. Coin Change
DescriptionYou are given coins of different denominations and a total amount of money amount. Write a function to compute the fewest number of coins that you need to make up that amount. If that a...
2018-07-07 19:45:12 218
原创 LeetCode-221. Maximal Square
DescriptionGiven a 2D binary matrix filled with 0's and 1's, find the largest square containing only 1's and return its area.ExampleInput: 1 0 1 0 01 0 1 1 11 1 1 1 11 0 0 1 0Output:...
2018-07-06 19:11:46 182
原创 LeetCode-139. Word Break
DescriptionGiven 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 sequence of one or more dictionary word...
2018-07-06 17:40:30 150
原创 LeetCode-416. Partition Equal Subset Sum
DescriptionGiven 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.Note1.Eac...
2018-07-06 15:57:46 167
原创 LeetCode-309. Best Time to Buy and Sell Stock with Cooldown
DescriptionSay you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete as many transactions as you lik...
2018-07-05 16:38:49 128
原创 LeetCode-96. Unique Binary Search Trees
DescriptionGiven n, how many structurally unique BST's (binary search trees) that store values 1 ... n?ExampleInput: 3Output: 5Explanation:Given n = 3, there are a total of 5 unique BST...
2018-07-05 16:16:09 122
原创 LeetCode-494. Target Sum
DescriptionYou are given a list of non-negative integers, a1, a2, ..., an, and a target, S. Now you have 2 symbols + and -. For each integer, you should choose one from + and - as its new symbol....
2018-07-05 15:27:16 247
原创 LeetCode-338. Counting Bits
DescriptionGiven a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1's in their binary representation and return them as an array.Example...
2018-07-04 14:29:55 175
原创 LeetCode-215. Kth Largest Element in an Array
DescriptionFind the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element.Example 1Input: [3,2,1,5,6,4] and k ...
2018-07-04 13:32:52 149
原创 LeetCode-240. Search a 2D Matrix II
DescriptionWrite an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:Integers in each row are sorted in ascending from left to right.In...
2018-07-04 11:19:28 164
原创 LeetCode-5. Longest Palindromic Substring
DescriptionGiven a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.Example 1Input: "babad"Output: "bab"Note: "aba" is also a vali...
2018-07-03 20:28:00 121
原创 LeetCode-17. Letter Combinations of a Phone Number
DescriptionGiven a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on the telephone ...
2018-07-03 19:59:19 155
原创 LeetCode-22. Generate Parentheses
DescriptionGiven n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.ExampleFor example, given n = 3, a solution set is:[ "((()))", "(()())...
2018-07-02 20:20:30 129
原创 LeetCode-647. Palindromic Substrings
DescriptionGiven a string, your task is to count how many palindromic substrings in this string.The substrings with different start indexes or end indexes are counted as different substrings eve...
2018-07-02 20:07:15 132
原创 LeetCode-279. Perfect Squares
DescriptionGiven a positive integer n, find the least number of perfect square numbers (for example, 1, 4, 9, 16, ...) which sum to n.Example 1Input: n = 12Output: 3 Explanation: 12 = 4 + ...
2018-07-02 14:53:53 4069
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人