摘要: Write a function to find the longest common prefix string amongst an array of strings. 题意:找出所有字符串共同的最长前缀; 思路:因为是共同前缀,所以,求得第一个字符串和第二个字符的共同前缀以后,以这个前缀和后面 阅读全文
posted @ 2017-07-18 15:22 王大咩的图书馆 阅读(199) 评论(0) 推荐(0) 编辑
摘要: Reverse digits of an integer. Example1: x = 123, return 321Example2: x = -123, return -321 click to show spoilers. Have you thought about this? Here a 阅读全文
posted @ 2017-07-18 10:46 王大咩的图书馆 阅读(340) 评论(0) 推荐(0) 编辑
摘要: Given an array of integers, every element appears three times except for one. Find that single one. Note: Your algorithm should have a linear runtime 阅读全文
posted @ 2017-07-18 10:10 王大咩的图书馆 阅读(130) 评论(0) 推荐(0) 编辑
摘要: Given an array of integers, every element appears twice except for one. Find that single one. Note: Your algorithm should have a linear runtime comple 阅读全文
posted @ 2017-07-18 09:35 王大咩的图书馆 阅读(211) 评论(0) 推荐(1) 编辑
摘要: 一、数据结构的栈和堆 首先在数据结构上要知道堆栈,尽管我们这么称呼它,但实际上堆栈是两种数据结构:堆和栈。堆和栈都是一种数据项按序排列的数据结构。 1)栈就像装数据的桶或箱子 我们先从大家比较熟悉的栈说起吧,它是一种具有后进先出性质的数据结构,也就是说后存放的先取,先存放的后取。这就如同我们要取出放 阅读全文
posted @ 2017-07-18 00:51 王大咩的图书馆 阅读(433) 评论(0) 推荐(0) 编辑