技术自留地


  • 首页

  • 标签

  • 分类

  • 归档

  • 搜索

颜值打分Summary

发表于 2018-06-09 | 分类于 Computer Vision

日常trick

发表于 2018-04-20 | 分类于 Code

日常trick

  • numpy 矩阵正则化

    阅读全文 »

《剑指Offer》笔记

发表于 2018-03-20 | 分类于 Algorithm

剑指Offer

  1. Chapter 1:面试的流程

    1. 一定要在代码开头处考虑边界条件,特殊输入(空指针,空字符串),错误处理等意外情况。
    阅读全文 »

二叉搜索树的后序遍历序列

发表于 2018-01-23 | 分类于 Algorithm

输入一个整数数组,判断该数组是不是某二叉搜索树的后序遍历的结果。如果是则输出Yes,否则输出No。假设输入的数组的任意两个数字都互不相同。

阅读全文 »

二分查找小结

发表于 2018-01-04 | 分类于 Algorithm

​ 最近和浩博讨论了下几道关于二分查找的题目。正好做一下总结,方便下一次能够快速手写出二分的算法。

​ 其实,二分查找,可以用下图简单表示流程。

​

阅读全文 »

172. Factorial Trailing Zeroes

发表于 2017-12-21 | 分类于 LeetCode

Given an integer n, return the number of trailing zeroes in n!.

Note: Your solution should be in logarithmic time complexity.

题意:找出n!的后缀零(结尾有多少个0)。

阅读全文 »

10. Regular Expression Matching

发表于 2017-12-18 | 分类于 LeetCode

Implement regular expression matching with support for '.' and '*'.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
> '.' Matches any single character.
> '*' Matches zero or more of the preceding element.
>
> The matching should cover the entire input string (not partial).
>
> The function prototype should be:
> bool isMatch(const char *s, const char *p)
>
> Some examples:
> isMatch("aa","a") → false
> isMatch("aa","aa") → true
> isMatch("aaa","aa") → false
> isMatch("aa", "a*") → true
> isMatch("aa", ".*") → true
> isMatch("ab", ".*") → true
> isMatch("aab", "c*a*b") → true
>

​ 题意:正则匹配,判断p是否匹配s。其中’.’匹配任意单个字符,’*’匹配0个或多个的前一字符。

阅读全文 »

279. Perfect Squares

发表于 2017-12-04 | 分类于 LeetCode

Given a positive integer n, find the least number of perfect square numbers (for example, 1, 4, 9, 16, ...) which sum to n.

For example, given n = 12, return 3 because 12 = 4 + 4 + 4; given n = 13, return 2 because 13 = 4 + 9.

题意:给出一个数n,判断它最少可以由多少个完全平方数相加而成。

阅读全文 »

300. Longest Increasing Subsequence

发表于 2017-12-02 | 分类于 LeetCode

Given an unsorted array of integers, find the length of longest increasing subsequence.

For example,
Given [10, 9, 2, 5, 3, 7, 101, 18],
The longest increasing subsequence is [2, 3, 7, 101], therefore the length is 4. Note that there may be more than one LIS combination, it is only necessary for you to return the length.

Your algorithm should run in O(n2) complexity.

Follow up: Could you improve it to O(n log n) time complexity?

阅读全文 »

416. Partition Equal Subset Sum

发表于 2017-12-02 | 分类于 LeetCode

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:

  1. Each of the array element will not exceed 100.

  2. The array size will not exceed 200.

    阅读全文 »
123…6
chaopengz

chaopengz

北航|北大|码农|图形学

56 日志
12 分类
15 标签
© 2021 chaopengz
由 Hexo 强力驱动
|
主题 — NexT.Gemini v5.1.3