
Leetcode刷题日志
acgl
A Craftsman of Coding,want to do the interesting thing
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Leetcode:26 Remove Duplicates from Sorted Array
问题描述: Given a sorted array, remove the duplicates in-place such that each element appear only once and return the new length. Do not allocate extra space for another array, you must do this by原创 2017-11-21 17:46:37 · 263 阅读 · 0 评论 -
Leetcode:14. Longest Common Prefix
问题描述: Write a function to find the longest common prefix string amongst an array of strings. 思路分析: 对于找到公共最长前缀子串,最简单的方法就是以第一个串为基准,以第一个串的每个字符作为一个匹配量,依次跟后面每一个串的对应位置的字符串相比较。在匹配成功时将此字符与存入一个新的数组中,最终函数返原创 2017-11-21 17:25:45 · 345 阅读 · 0 评论 -
编程之美之八皇后问题
问题描述 : 八皇后问题是一个以国际象棋为背景的问题:如何能够在8×8的国际象棋棋盘上放置八个皇后,使得任何一个皇后都无法直接吃掉其他的皇后?为了达到此目的,任两个皇后都不能处于同一条横行、纵行或斜线上。八皇后问题可以推广为更一般的n皇后摆放问题:这时棋盘的大小变为n×n,而皇后个数也变成n。当且仅当n = 1或n ≥ 4时问题有解; 解题思路: 回溯法(英语:backtrack转载 2017-11-23 13:35:45 · 607 阅读 · 0 评论 -
Leetcode 65:Valid Number
Validate if a given string is numeric. Some examples: "0" => true " 0.1 " => true "abc" => false "1 a" => false "2e10" => true Note: It is intended for the problem statement to be ambiguo翻译 2017-11-27 19:30:08 · 350 阅读 · 0 评论 -
小米笔试题 求数的高度 c++代码
问题描述: 时间限制:C/C++语言 1000MS;其他语言 3000MS内存限制:C/C++语言 65536KB;其他语言 589824KB题目描述:现在有一棵合法的二叉树,树的节点都是用数字表示,现在给定这棵树上所有的父子关系,求这棵树的高度输入输入的第一行表示节点的个数n(1<=n<=1000,节点的编号为0到n-1)组成,下面是n-1行,每行有两个整数,第一个数表示父节点的编...原创 2018-09-08 11:54:32 · 760 阅读 · 0 评论