Problem Description:
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)...
分类:
其他好文 时间:
2014-08-01 00:11:50
阅读次数:
285
第一次实现堆排序,花了近两个小时。
主要还是堆调整,原理网上很多,直接给出运行代码和结果:
代码:
#include
using namespace std;
void adjustHeap(int number[],int k,int length){
int t=number[k];
int i;
for(; k*2+1 < length; k=i){
i=k*2...
分类:
其他好文 时间:
2014-08-01 00:10:20
阅读次数:
285
Minimum Inversion Number
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 10326 Accepted Submission(s): 6359
Problem Description
The invers...
分类:
其他好文 时间:
2014-08-01 00:08:10
阅读次数:
299
给出动态更新数据,实时问第K个大的数值是什么?
利用AVL数据结构做的一个统计数,比较高级的数据结构内容了。
不知道题目给出的数据值是否有重复,因为我下面的程序是可以处理出现数据重复的情况的。
其中的奥妙是增加了repeat的信息,可以知道出现了当前数组多少次。
主要是知道如何维护这些数据和如何查询,维护数据的函数是pushUp,查询函数是selectKth。
其他就是一般的AVL操作。...
分类:
其他好文 时间:
2014-08-01 00:07:00
阅读次数:
273
虽然学习js有一段时间了,但是对js的基础语法却是有些生疏。最近在看jquery源码,决定随带总结一些基础的语法知识。今天总结一下数据类型和typeof,这在写js的时候,是不得不知道的知识。 数据类型: js有5中基本的数据类型:undefined,Null,Boolean,Number,...
分类:
其他好文 时间:
2014-07-31 23:42:10
阅读次数:
231
E -Palindromic NumbersTime Limit:2000MSMemory Limit:32768KB64bit IO Format:%lld & %lluDescriptionA palindromic number or numeral palindrome is a 'symm...
分类:
其他好文 时间:
2014-07-31 23:36:50
阅读次数:
360
Maximum Depth of Binary TreeGiven a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root ...
分类:
其他好文 时间:
2014-07-31 23:19:10
阅读次数:
259
/*
2^x mod n = 1
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 11800 Accepted Submission(s): 3673
Problem Description
Give a number n...
分类:
其他好文 时间:
2014-07-31 20:58:04
阅读次数:
171
Problem Description:
Given an array of integers, find two numbers such that they add up to a specific target number.
The function twoSum should return indices of the two numbers such that they...
分类:
其他好文 时间:
2014-07-31 20:48:17
阅读次数:
215
1. c++中string到int的转换1) 在C标准库里面,使用atoi:#include #include std::string text = "152"; int number = std::atoi( text.c_str() ); if (errno == ERANGE) //可能是s....
分类:
编程语言 时间:
2014-07-31 19:48:27
阅读次数:
294