自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

宿于松下的技术博客

努力成为技术大师

  • 博客(58)
  • 资源 (3)
  • 收藏
  • 关注

原创 LeetCode——Populating Next Right Pointers in Each Node

题目:Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; }Populate each next pointer to point to its next right node. If there

2015-07-19 16:04:26 414 1

原创 LeetCode——Insertion Sort List

题目:Sort a linked list using insertion sort.解答:/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * };

2015-07-18 23:08:40 374

原创 LeetCode——Binary Tree Preorder Traversal

题目:Given a binary tree, return the preorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3return [1,2,3].解答:/** * Definition for a binary tree n

2015-07-18 00:31:14 404

原创 LeetCode——Evaluate Reverse Polish Notation

题目:Evaluate the value of an arithmetic expression in Reverse Polish Notation.Valid operators are +, -, *, /. Each operand may be an integer or another expression.Some examples: ["2", "1", "+", "3", "*

2015-07-08 23:15:55 293

原创 LeetCode——Find Minimum in Rotated Sorted Array

题目:Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).Find the minimum element.You may assume no duplicate exists in the array.解答

2015-07-08 20:07:07 303

原创 LeetCode——Container With Most Water

题目:Given n non-negative integers a1, a2, …, an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). Find two

2015-06-28 00:59:22 260

原创 LeetCode——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”].解答:class Solution {public: string numToStr(int n

2015-06-27 20:24:33 380

原创 LeetCode——Same Tree

题目: Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identical and the nodes have the same value.解答:/** * Defi

2015-06-24 23:18:51 317

原创 LeetCode——Merge Sorted Array

题目:Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.Note: You may assume that nums1 has enough space (size that is greater or equal to m + n) to hold additio

2015-06-24 23:13:12 351

原创 LeetCode——Symmetric Tree

题目:Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree is symmetric: 1 / \ 2 2 / \ / \3 4 4 3But the following is n

2015-06-23 23:31:28 276

原创 LeetCode——Binary Tree Level Order Traversal II

题目: Given a binary tree, return the bottom-up level order traversal of its nodes’ values. (ie, from left to right, level by level from leaf to root).For example: Given binary tree {3,9,20,#,#,15,7},

2015-06-23 22:46:47 340

原创 iOS Crash相关转载

iOS Crash文件的解析(一) 本文介绍了:1. Crash文件结构(Process Information(进程信息)、Basic Information、Exception、Thread Backtrace、Thread State、Binary Images)2. 常见的Crash类型(Watchdog timeout、User force-quit、Low Memory termin

2015-06-22 22:58:44 456

转载 分析iOS Crash文件:符号化iOS Crash文件的3种方法

分析iOS Crash文件:符号化iOS Crash文件的3种方法

2015-06-22 22:44:34 146

转载 iOS Crash文件格式介绍

iOS Crash文件的解析(一)

2015-06-22 22:41:05 151

原创 LeetCode——Plus One

题目:Given a non-negative number represented as an array of digits, plus one to the number.The digits are stored such that the most significant digit is at the head of the list.解答:class Solution {public

2015-06-22 01:07:12 345

原创 LeetCode——Climbing Stairs

题目:You are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?解答:class Solution {public: in

2015-06-22 00:22:07 286

原创 LeetCode——Binary Tree Level Order Traversal

题目: Given a binary tree, return the level order traversal of its nodes’ values. (ie, from left to right, level by level).For example: Given binary tree {3,9,20,#,#,15,7}, 3 / \ 9 20 / \

2015-06-22 00:10:21 327

原创 LeetCode——Balanced Binary Tree

题目: Given a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two subtrees of every node never diffe

2015-06-21 13:26:29 253

原创 LeetCode——Minimum Depth of Binary Tree

题目: Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node.解答:/** * Definition for a binary tree

2015-06-18 13:34:04 286

原创 LeetCode——Path Sum

题目:Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.For example: Given the below binary tree and sum

2015-06-17 23:39:41 248

原创 LeetCode——Remove Duplicates from Sorted List

题目:Given a sorted linked list, delete all duplicates such that each element appear only once.For example,Given 1->1->2, return 1->2.Given 1->1->2->3->3, return 1->2->3.解答:/** * Definition for singly-

2015-06-17 23:22:02 239

原创 LeetCode——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 in place with

2015-06-17 13:26:32 227

原创 LeetCode——Valid Palindrome

题目: Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example, “A man, a plan, a canal: Panama” is a palindrome. “race a car” is not a

2015-06-16 22:15:39 256

原创 LeetCode——Min Stack

题目: Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.push(x) – Push element x onto stack. pop() – Removes the element on top of the stack. top() – Get

2015-06-16 21:48:01 245

原创 LeetCode——Merge Two Sorted Lists

题目: Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.解答:/** * Definition for singly-linked list. * struct

2015-06-16 13:43:32 277

原创 LeetCode——Intersection of Two Linked Lists

题目: Write a program to find the node at which the intersection of two singly linked lists begins.For example, the following two linked lists:A: a1 → a2 ↘

2015-06-15 23:36:43 309

原创 LeetCode——Majority Element

题目: Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times.You may assume that the array is non-empty and the majority element al

2015-06-15 21:25:24 293

原创 LeetCode——Factorial Trailing Zeroes

题目: Given an integer n, return the number of trailing zeroes in n!.Note: Your solution should be in logarithmic time complexity.解答:class Solution {public: int trailingZeroes(int n) { int

2015-06-15 19:39:09 480

原创 LeetCode——Rotate Array

题目: Rotate an array of n elements to the right by k steps.For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to [5,6,7,1,2,3,4].解答:class Solution {public: void reverse(int l,

2015-06-13 23:08:31 284

原创 LeetCode——House Robber

题目: You 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 is that adjacent h

2015-06-13 13:23:18 264

原创 LeetCode——Invert Binary Tree

题目: Invert a binary tree. 4 / \ 2 7 / \ / \1 3 6 9to 4 / \ 7 2 / \ / \9 6 3 1解答:/** * Definition for a binary tree node. * struct TreeNode { * int

2015-06-12 23:45:56 321

原创 LeetCode——Happy Number

题目: Write 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 the sum of the squares

2015-06-12 23:32:50 395

原创 LeetCode——Remove Linked List Elements

题目: Remove all elements from a linked list of integers that have value val.Example Given: 1 –> 2 –> 6 –> 3 –> 4 –> 5 –> 6, val = 6 Return: 1 –> 2 –> 3 –> 4 –> 5解答:/** * Definition for singly-linked

2015-06-09 22:16:44 296

原创 LeetCode——Palindrome Number

题目: Determine whether an integer is a palindrome. Do this without extra space.解答://调优后的算法表现还不是很好,不知道还有没有更好的算法,暂时就这样吧!//11506 / 11506 test cases passed.//Status: Accepted//Runtime: 56 msclass Soluti

2015-06-09 21:55:36 287

原创 LeetCode——Reverse Integer

题目: Reverse digits of an integer.Example1: x = 123, return 321 Example2: x = -123, return -321解答:class Solution {public: int reverse(int x) { int k = x < 0 ? -1 : 1; int abs = x *

2015-06-09 10:17:17 308

原创 LeetCode——Rectangle Area

题目:Find 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.Assume that the total area is

2015-06-08 21:25:58 362

原创 iOS常见编码规范指引

参考文档:Coding Guidelines for Cocoa Google Objective-C Style Guide 中文版 [Cocoa]苹果 Cocoa 编码规范(白云飘飘博客)1留白和空格1.1空格 vs. 制表符Tip只使用空格,且一次缩进两个空格。我们使用空格缩进。不要在代码中使用制表符。你应该将编辑器设置成自动将制表符替换成空格。1.2行宽尽量让你的代码保持在 120

2015-06-08 15:54:48 585

原创 LeetCode——Maximum Depth of Binary Tree

题目:Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.解答:/** * Definition for a binary tree n

2015-06-08 11:17:02 383

原创 LeetCode——Isomorphic Strings

题目:Given 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 must be replaced with another ch

2015-06-07 23:56:11 335

原创 LeetCode——Reverse Linked List

题目:Reverse a singly linked list.解答:/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class S

2015-06-07 23:14:07 398

小米2014校园招聘

小米2014校园招聘研发,3道编程题,3道编程题。

2013-10-17

高德2014校园招聘c++

高德2014校园招聘c++~50分选择题(单选+多选),50分编程题(3道)

2013-10-17

微策略2014校园招聘试题

微策略2014校园招聘试题-6道程序设计题,高清~

2013-10-17

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除