码迷,mamicode.com
首页 >  
搜索关键字:leetcoode    ( 9个结果
leetcoode刷题 453. Minimum Moves to Equal Array Elements
453. Minimum Moves to Equal Array Elements Given a non-empty integer array of size n, find the minimum number of moves required to make all array elem ...
分类:其他好文   时间:2018-09-15 00:37:19    阅读次数:138
LeetCode—House Robber 寻找数组不相邻组合最大值DP
https://leetcode.com/problems/house-robber/ 题目设计了一个抢劫犯的情景,其实就是求数组中不相邻数据进行组合得到的最大值 举一个例子 假设数据: 8 3 6 15 4 9 7 10 那么首先可能选取 8 , 3 每一个数字的选取都是根据他的前两个数字,前三个数字得到的最大值进行选择,等到6的时候考虑前面只能和8组合  8,3,14 到数字15,...
分类:编程语言   时间:2015-04-13 00:28:01    阅读次数:164
LeetCode—Set Matrix Zeroes 矩阵数组值为0,至行,列为0
Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place. 题目没有什么难度,但是可以在空间复杂度上做一些处理: 开始写的算法比较简单,将行和列中为0的部分记录下来,然后再经过一个赋值操作: class Solution { public: void s...
分类:编程语言   时间:2015-04-11 17:55:45    阅读次数:188
Binary Tree Right Side View 二叉树层序遍历变形
Given a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom. For example: Given the following binary tree, 1...
分类:其他好文   时间:2015-04-11 17:52:51    阅读次数:109
LeetCode—Palindrome Number 数字是否是回文数字
Determine whether an integer is a palindrome. Do this without extra space. 检测当前数字是否是回文数字,同时不能增加额外的内存空间,这里一个注意的点就是 负数 都不可能是回文数字 然后是检测出来每一位数字进行比较 代码还是写得比较繁琐,主要的一个点就是数字的位数是基数位和偶数位的时候处理的过程是不同的 c...
分类:其他好文   时间:2015-04-08 16:37:01    阅读次数:115
LeetCode—*Spiral Matrix问题,主要是用到了方向矩阵,很创意
Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order. For example, Given the following matrix: [ [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] ] You ...
分类:其他好文   时间:2015-03-29 23:49:53    阅读次数:369
LeetCode-Multiply Strings实现大数的乘法
Given two numbers represented as strings, return multiplication of the numbers as a string. Note: The numbers can be arbitrarily large and are non-negative. 题目当中主要是需要两个大数的乘法,一般大数都是用字符串进行保存 代码比较...
分类:其他好文   时间:2015-03-29 19:35:52    阅读次数:133
LeetCoode—**Convert Sorted List to Binary Search Tree 将单链表表示为平衡二叉
Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST. 我想如果只是表示成二叉树,没有什么难度,但是如果是表示为平衡二叉树那么可能就有难度了 要求左右子树的高度是均衡的 先给出自己的解法,很low,就是现将节点都保存在vector...
分类:其他好文   时间:2015-03-21 17:10:11    阅读次数:158
【LeetCode】LeetCoode 大牛解法转载
http://blog.unieagle.net/category/develop/%E7%AE%97%E6%B3%95/
分类:其他好文   时间:2014-05-10 01:01:59    阅读次数:223
9条  
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!