首页 > 其他 > 详细

Leetcode 题目整理-4

时间:2016-12-12 09:31:58      阅读:144      评论:0      收藏:0      [点我收藏+]

14. Longest Common Prefix

Write a function to find the longest common prefix string amongst an array of strings.

注:这题竟然连个示例都没有,说明特殊情况并不多,就是要找出所有字符串的最长公共前缀。他应该不会超过所有字符串中最短的那个,可以试着找出最短长度n,然后每个都读取和比较n个,并根据情况不断减小那个n.

19. Remove Nth Node From End of List

Given a linked list, remove the nth node from the end of list and return its head.

For example,

Given linked list: 1->2->3->4->5, and n = 2.

 

After removing the second node from the end, the linked list becomes 1->2->3->5.

Note:
Given n will always be valid.
Try to do this in one pass.

注:给出一个链表,把倒数第n个元素移除。听起来很常用的技术,了解一下链表的结构,用处 ,优势,再来做这个题。

Leetcode 题目整理-4

原文:http://www.cnblogs.com/simayuhe/p/6163191.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!