- 博客(23)
- 收藏
- 关注
原创 LEETCODE--Excel Sheet Column Title
Given a positive integer, return its corresponding column title as appear in an Excel sheet.For example: 1 -> A 2 -> B 3 -> C … 26 -> Z 27 -> AA 28 -> AB 利用十进制转化二进制
2015-11-24 21:39:21 367
原创 LEETCODE--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 version is developed based on the
2015-11-23 17:49:32 395 1
原创 LEETCODE-MinStack
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()
2015-11-21 15:25:38 238
原创 int类型转string的数种方法;
方法一: 在此方法中使用了sprintf()函数 百度百科介绍sprintf 详细讲解sprintf()我的理解: 我认为sprintf是C语言中的函数,因为在使用时括号中的参数需要定义数据类型(如本程序中的%d),而且只能用诸如char a[]的字符串数组进行操作(sprintf与printf的区别就是,sprintf是将结果输出在字符串中,而printf将结果输出在控制台窗口
2015-11-19 20:21:20 468
原创 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”]. 方法一: 本问题最大的障碍就是实现将int类型转换为字符串; 在此方法中使用了sprintf()函数 百
2015-11-19 17:35:55 296
原创 关于mysql-5.7.9-winx64以及其他系列安装的问题解决
输入net start mysql时出现的问题:-------------------------------------------------------------------C:\Windows\system32>net start mysqlMySQL 服务正在启动 .MySQL 服务无法启动。服务没有报告任何错误。请键入 NET HELP
2015-11-17 22:09:39 1083 1
原创 LEETCODE--Count Primes
Description:Count the number of prime numbers less than a non-negative number, n.Credits: Special thanks to @mithmatt for adding this problem and creating all test cases.Hint:1.Let’s start with a isPr
2015-11-16 14:54:13 374
原创 LEETCODE--ZigZag Conversion
The string “PAYPALISHIRING” is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) P A H N A P L S I I
2015-11-14 22:30:51 272
原创 LEETCODE--Binary Tree Paths
Given a binary tree, return all root-to-leaf paths. For example, given the following binary tree: 1 / \ 2 3 \ 5All root-to-leaf paths are: [“1->2->5”, “1->3”]Credits: Special thanks to
2015-11-13 16:50:46 232
原创 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.Subscribe to see which companies asked this
2015-11-12 15:45:45 234
原创 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 / \ 15
2015-11-12 11:14:43 228
原创 LEETCODE--Pascal's Triangle II
Given an index k, return the kth row of the Pascal’s triangle.For example, given k = 3, Return [1,3,3,1]. Note: Could you optimize your algorithm to use only O(k) extra space? Subscribe to see whic
2015-11-12 10:27:06 215
原创 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-11-11 20:33:58 221
原创 LEETCODE--Pascal's Triangle
Given numRows, generate the first numRows of Pascal’s triangle.For example, given numRows = 5, Return [ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1] ]Subscribe to see which comp
2015-11-09 20:44:49 235
原创 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}, 3
2015-11-09 11:10:15 242
原创 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
2015-11-08 11:47:52 282
原创 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 differ by
2015-11-07 20:20:49 247
原创 LEETCODE--Lowest Common Ancestor of a Binary Search Tree
Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST. According to the definition of LCA on Wikipedia: “The lowest common ancestor is defined between tw
2015-11-07 16:09:08 216
原创 LEETCODE-Invert Binary Tree
Invert a binary tree. 4 / \ 2 7 / \ / \ 1 3 6 9 to 4 / \ 7 2 / \ / \ 9 6 3 1 Trivia: This problem was inspired by this original tweet by Max How
2015-11-05 16:38:39 251
原创 数据结构--二叉树的创建、先序遍历、中序遍历、后序遍历、深度、叶子结点数
*用cin来读取char类型时,没法读入“ ”(space),所以要改用getchar()(在头文件#include<iostream>#include<stdlib.h>#include<stdio.h>using namespace std;typedef struct BiTNode { char date; struct BiTNode *lchild, *rchil
2015-11-05 10:24:45 698
原创 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. Subscribe to see
2015-11-01 21:32:42 282
原创 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.Subscribe to see which companies asked this
2015-11-01 20:53:47 334
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人