- 博客(10)
- 收藏
- 关注
原创 1064. Complete Binary Search Tree
A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties: The left subtree of a node contains only nodes with keys less than the node's key. The righ
2017-08-08 09:39:04 274
原创 1008. Elevator (20)
The highest building in our city has only one elevator. A request list is made up with N positive numbers. The numbers denote at which floors the elevator will stop, in specified order. It costs 6 sec
2017-07-31 20:05:25 210
原创 dynamic_cast 运算符
今天从头开始读代码,发现 dynamic_cast 。例如B C D 。B是基类,C D 依次继承上层,则可以有 class B { }; class C : public B { }; class D : public C { }; void f(D* pd) { C* pc = dynamic_cast(pd); // ok: C is a direct
2017-07-31 14:37:09 191
原创 剑指Offer——二叉树的镜像
操作给定的二叉树,将其变换为源二叉树的镜像。 输入描述:二叉树的镜像定义:源二叉树 8 / \ 6 10 / \ / \ 5 7 9 11 镜像二叉树 8 / \ 10 6 / \ / \ 11 9 7 5 /*struc
2017-07-05 21:24:56 168
原创 389. Find the Difference
Given two strings s and t which consist of only lowercase letters. String t is generated by random shuffling string s and then add one more letter at a random position. Find the letter that was
2017-04-25 00:18:22 234
原创 136. Single Number
Given an array of integers, every element appears twice except for one. Find that single one. Note: Your algorithm should have a linear runtime complexity. Could you implement it without using ext
2017-04-24 23:28:53 136
原创 476. Number Complement
Given a positive integer, output its complement number. The complement strategy is to flip the bits of its binary representation. Note: The given integer is guaranteed to fit within the range of
2017-04-21 16:37:03 160
原创 461. Hamming Distance
The Hamming distance between two integers is the number of positions at which the corresponding bits are different. Given two integers x and y, calculate the Hamming distance. Note: 0 ≤ x,
2017-04-20 20:05:47 152
原创 递归
#include int getPeachNumber(int n) { int num; //定义所剩桃子数 if(n==10) { return 1; //递归结束条件 } else { num = (getPeachNumber(n+1)+1)*2; //这里是不应该用递归呢?
2017-04-14 20:10:24 239
原创 基础练习BASIC-8-回文数
问题描述 1221是一个非常特殊的数,它从左边读和从右边读是一样的,编程求所有这样的四位十进制数。 (第一个自己独立做出来的) 输出格式 按从小到大的顺序输出满足条件的四位十进制数。 public class Main{ public static void main(String[] args) { int sum; for(sum=1000;sum i
2017-03-11 20:25:20 152
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人