上一页 1 ··· 19 20 21 22 23 24 25 26 27 ··· 30 下一页

2017年12月19日

remove element

摘要: Given an array and a value, remove all instances of that value in-place and return the new length. Do not allocate extra space for another array, you 阅读全文

posted @ 2017-12-19 10:05 夜的第八章 阅读(122) 评论(0) 推荐(0) 编辑

伸展树--java

摘要: 文字转载自:http://www.cnblogs.com/vamei 代码转载自:http://www.blogjava.net/javacap/archive/2007/12/19/168627.html 我们讨论过,树的搜索效率与树的深度有关。二叉搜索树的深度可能为n,这种情况下,每次搜索的复杂 阅读全文

posted @ 2017-12-19 09:27 夜的第八章 阅读(648) 评论(0) 推荐(0) 编辑

2017年12月18日

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 fo 阅读全文

posted @ 2017-12-18 21:05 夜的第八章 阅读(164) 评论(0) 推荐(0) 编辑

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. Example: 阅读全文

posted @ 2017-12-18 20:11 夜的第八章 阅读(171) 评论(0) 推荐(0) 编辑

valid parentheses

摘要: parentheses:括号 Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. The brackets mus 阅读全文

posted @ 2017-12-18 19:37 夜的第八章 阅读(139) 评论(0) 推荐(0) 编辑

Longest Common Prefix

摘要: Write a function to find the longest common prefix string amongst an array of strings. 找出所有字符串中的共同字符串前缀。 方法一:让第一个字符串作为基准,遍历该字符串,依次将该字符串中的每个字符跟其他所有字符串相 阅读全文

posted @ 2017-12-18 19:01 夜的第八章 阅读(176) 评论(0) 推荐(0) 编辑

palindrome number(回文数)

摘要: Determine whether an integer is a palindrome. Do this without extra space. Some hints: Could negative integers be palindromes? (ie, -1) If you are thi 阅读全文

posted @ 2017-12-18 16:30 夜的第八章 阅读(174) 评论(0) 推荐(0) 编辑

Two Sum

摘要: Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have ex 阅读全文

posted @ 2017-12-18 14:34 夜的第八章 阅读(146) 评论(0) 推荐(0) 编辑

2017年12月17日

Average of Levels in Binary Tree

摘要: Given a non-empty binary tree, return the average value of the nodes on each level in the form of an array. Example 1: 还是应用广度优先遍历(BFS),然后计算每一层的和就行 阅读全文

posted @ 2017-12-17 13:04 夜的第八章 阅读(123) 评论(0) 推荐(0) 编辑

Array Partition I

摘要: Given an array of 2n integers, your task is to group these integers into n pairs of integer, say (a1, b1), (a2, b2), ..., (an, bn) which makes sum of 阅读全文

posted @ 2017-12-17 12:45 夜的第八章 阅读(113) 评论(0) 推荐(0) 编辑

上一页 1 ··· 19 20 21 22 23 24 25 26 27 ··· 30 下一页

导航