- 博客(30)
- 资源 (7)
- 问答 (1)
- 收藏
- 关注
原创 Minimum Window Substring 最小窗口覆盖所有字串
Minimum Window SubstringGiven a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n).For example,S = "ADOBECODEBANC"T = "
2015-09-28 11:30:12 611
原创 Binary Tree Postorder Traversal 非递归实现二叉树后序遍历
Binary Tree Postorder TraversalGiven a binary tree, return the postorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3retur
2015-09-25 11:09:42 937
原创 Move Zeroes 移动0的个数到数组末尾
Move ZeroesGiven an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements.For example, given nums = [0, 1, 0, 3,
2015-09-25 10:57:39 651
原创 Lowest Common Ancestor of a Binary Tree 二叉树的公共祖先
Lowest Common Ancestor of a Binary TreeGiven a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree.According to the definition of LCA on Wikipedia: “The lowes
2015-09-24 11:07:02 450
原创 House Robber 动态规划
House RobberYou are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them
2015-09-24 10:56:29 439
原创 Maximal Rectangle 二维矩形中最大的1个数
Maximal RectangleGiven a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and return its area.class Solution {public:/*011011101001110111101
2015-09-23 16:22:57 585
原创 Largest Rectangle in Histogram 一排矩形中的最大的面积
Largest Rectangle in HistogramGiven n non-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle in the histogram.
2015-09-23 15:44:30 533
原创 Happy Number 数组变换循环判断
Happy NumberWrite an algorithm to determine if a number is "happy".A happy number is a number defined by the following process: Starting with any positive integer, replace the number by th
2015-09-23 11:10:55 434
原创 Kth Smallest Element in a BST 寻找二叉排序树中第k小元素
Kth Smallest Element in a BSTGiven a binary search tree, write a function kthSmallest to find the kth smallest element in it.Note: You may assume k is always valid, 1 ≤ k ≤ BST's total
2015-09-22 14:53:07 1152
原创 Remove Linked List Elements 删除链表中指定元素
Remove Linked List ElementsRemove all elements from a linked list of integers that have value val.ExampleGiven: 1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6, val = 6Return: 1 --> 2 --> 3 -->
2015-09-22 14:38:45 535
原创 Number of Digit One 计算十进制1出现的个数
Number of Digit OneGiven an integer n, count the total number of digit 1 appearing in all non-negative integers less than or equal to n.For example:Given n = 13,Return 6, because digit
2015-09-21 14:43:13 569
原创 Count Primes 筛选法求素数
Count PrimesDescription:Count the number of prime numbers less than a non-negative number, n.The Sieve of Eratosthenes uses an extra O(n) memory and its runtime complexity is O(n log
2015-09-21 14:15:28 439
原创 Majority Element II 寻找数组中出现次数大于n/3的数
Majority Element IIGiven an integer array of size n, find all elements that appear more than ⌊ n/3 ⌋ times. The algorithm should run in linear time and in O(1) space.class Solution {pub
2015-09-19 16:40:05 411
原创 Isomorphic Strings 两个字符串的同构 map操作
Isomorphic StringsGiven two strings s and t, determine if they are isomorphic.Two strings are isomorphic if the characters in s can be replaced to get t.All occurrences of a character mu
2015-09-19 16:23:28 464
原创 Contains Duplicate 重复数的判断
Contains DuplicateGiven an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the array, and it should retu
2015-09-18 11:09:56 414
原创 Rectangle Area 两个矩形的面积
Rectangle AreaFind the total area covered by two rectilinear rectangles in a 2D plane.Each rectangle is defined by its bottom left corner and top right corner as shown in the figure.
2015-09-18 11:08:39 497
原创 Reverse Linked List 链表逆转 简单题
Reverse Linked ListReverse a singly linked list.click to show more hints./** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * Li
2015-09-18 11:07:04 460
原创 Search a 2D Matrix II 特殊数组的查找
Search a 2D Matrix II Write 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 f
2015-09-10 14:50:29 329
原创 Product of Array Except Self 数组除自身的所有乘积
Product of Array Except Self Given an array of n integers where n > 1, nums, return an array output such that output[i] is equal to the product of all the elements of nums except nums[i]
2015-09-10 14:49:33 524
转载 iOSInterviewQuestions/iOS面试问题
1. 风格纠错题typedef enum { UserSex_Man, UserSex_Woman}UserSex;@interface UserModel : NSObject@property (nonatomic, strong) NSString *name;@property (assign,nonatomic) int age;@property
2015-09-09 19:49:40 895
原创 H-Index II 二分查找
H-Index II Follow up for H-Index: What if the citations array is sorted in ascending order? Could you optimize your algorithm?Hint:Expected runtime complexity is in O(log n) and the
2015-09-09 14:10:33 671
原创 Integer to English Words 整数转换为英语表示
Integer to English Words Convert a non-negative integer to its english words representation. Given input is guaranteed to be less than 231 - 1.For example,123 -> "One Hundred Twenty
2015-09-09 14:07:55 590 3
原创 斯坦福大学公开课 iOS应用开发教程学习笔记(第四课) Views 视图
第一部分Demo简单计算器的实现 通过递归栈改变项目:http://blog.csdn.net/u012605629/article/details/48291629第二部分,Viewsview的内容1、View是屏幕上一个矩形的空间2、View处理两件事:画出矩形控件,并处理其中的事件3、view组织架构:Vie
2015-09-08 16:43:46 604
原创 斯坦福大学iOS应用开发教程学习笔记(第二课) 计算器实现2 改进版
主要内容同:http://blog.csdn.net/u012605629/article/details/48056593,有部分改进,更改了Calculator部分实现 使用一个递归栈实现。整个项目下载:https://github.com/junxianhu/Calculator-v2,觉得有帮助的可以点击Star啊,谢谢啦。贴几个变化的代码:Ca
2015-09-08 15:30:42 811
原创 First Bad Version 第一个坏数 二分查找
First Bad Version You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your product fails the quality check. Since each versi
2015-09-08 14:10:02 912
原创 H-Index 引用次数 排序
H-Index Given an array of citations (each citation is a non-negative integer) of a researcher, write a function to compute the researcher's h-index.According to the definition of h-index o
2015-09-08 14:08:24 920
原创 Invert Binary Tree 二叉树的镜像
Invert Binary TreeInvert a binary tree. 4 / \ 2 7 / \ / \1 3 6 9to 4 / \ 7 2 / \ / \9 6 3 1Trivia:This problem was inspired by this or
2015-09-06 11:31:17 366
原创 Implement Stack using Queues 两个队列实现一个栈
Implement Stack using Queues Implement the following operations of a stack using queues.push(x) -- Push element x onto stack.pop() -- Removes the element on top of the stack.top() -- Get
2015-09-06 11:28:16 431
原创 Summary Ranges 连续的数组格式化输出
Summary Ranges Given a sorted integer array without duplicates, return the summary of its ranges.For example, given [0,1,2,4,5,7], return ["0->2","4->5","7"].Credits:Special thanks to
2015-09-01 14:19:33 470
原创 Power of Two 判断是否为2的次方
Power of Two Given an integer, write a function to determine if it is a power of two.Credits:Special thanks to @jianchao.li.fighter for adding this problem and creating all test cases.
2015-09-01 11:05:25 421
spring mybatis sql语句使用注解描述
2016-10-08
TA创建的收藏夹 TA关注的收藏夹
TA关注的人