A peak element is an element that is greater than its neighbors.
Given an input array where num[i] ≠ num[i+1], find a peak element and return its index.
The array may contain multiple peaks, in ...
分类:
其他好文 时间:
2014-12-08 21:25:17
阅读次数:
177
题目
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-...
分类:
其他好文 时间:
2014-12-06 16:51:45
阅读次数:
195
4.1 实现一个函数,检查二叉树是否平衡。在这个问题中,平衡树的定义如下:任意一个结点,其两颗子树的高度差不超过1.C++实现代码:#include#include#includeusing namespace std;//Definition for binary treestruct TreeN...
分类:
其他好文 时间:
2014-12-05 22:41:02
阅读次数:
158
Given an array where elements are sorted in ascending order, convert it to a height balanced BST.
深搜+递归
/**
* Definition for binary tree
* public class TreeNode {
* int val;
* Tree...
分类:
其他好文 时间:
2014-12-05 17:34:59
阅读次数:
169
在android开发过程中,为了让其他的应用程序,也可以访问本应用程序的服务,android系统采用远程过程调用来实现。android通过接口来公开定义的服务。我们将能够夸进程访问的服务成为AIDL服务(Android Interface Definition Language)。本节主要讲述通过a...
分类:
移动开发 时间:
2014-12-05 17:02:13
阅读次数:
130
The current date and time is: Folder Name Description App_Browsers Contains browser definition fi...
分类:
Web程序 时间:
2014-12-04 15:33:11
阅读次数:
116
1 #分别取出当前脚本的父目录、文件名 2 $Currentpath1 = Split-Path -parent $MyInvocation.MyCommand.Definition 3 $Currentpath2 = Split-Path -leaf $MyInvocation.M...
分类:
其他好文 时间:
2014-12-04 11:37:16
阅读次数:
96
DTD=类型定义(Documnet Type Definition)XSD=XML结构定义 ( XML Schemas Definition )DTD 就相当于 XML 中的“词汇”和“语法”,不同的行业可以定义自己的“词汇”和“语法”,以利于解析器验证 XML 文档的有效性,并且这样也利于行业中和...
分类:
其他好文 时间:
2014-12-03 23:12:41
阅读次数:
309
Given a linked list, reverse the nodes of a linked listkat a time and return its modified list.If the number of nodes is not a multiple ofkthen left-o...
分类:
其他好文 时间:
2014-12-03 22:52:34
阅读次数:
114
题目
Sort a linked list in O(n log n)
time using constant space complexity.
解答
O(nlogn)时间复杂度的排序有快排、堆排、归并,一般双向链表用快排、单向链表用归并,堆排两种都可以,以下使用归并排序:
/**
* Definition for singly-linked list.
* class Li...
分类:
其他好文 时间:
2014-12-03 21:32:25
阅读次数:
138