摘要:
类似 输入eeffffgghhhhh输出efghefghfhfhh 时间有限,所以暴力解题了 代码如下: 阅读全文
摘要:
第一行表示有多少个数n第二行开始依次是1到n个数,一个数一行输出描述:输出一行,表示最少跳跃的次数。示例1输入72321215输出3 说明 7表示接下来要输入7个正整数,从2开始。数字本身代表可以跳跃的最大步长,此时有2种跳法,为2-2-2-5和2-3-2-5都为3步 阅读全文
摘要:
用了一种自创的比较简洁的方式来创建链表 阅读全文
摘要:
描述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 rem 阅读全文
摘要:
描述Given a list, rotate the list to the right by k places, where k is non-negative.For example: Given 1->2->3->4->5->nullptr and k = 2, return 4->5->1- 阅读全文
摘要:
断断续续用了半年的时间把LeetCode刷完了,之前复习了数据结构与算法。将刷题与复习数据结构结合起来会更有效果。总之不是为了刷题而刷题,而是为了巩固和补充一部分知识。 LeetCode真的是一个很好的题库,可惜没有早些时候发现它。现在有些公司的算法笔试题五花八门,但万变不离其宗。刷完LeetCod 阅读全文
摘要:
描述 Given a linked list, swap every two adjacent nodes and return its head.For example, Given 1->2->3->4, you should return the list as 2->1->4->3.Your 阅读全文
摘要:
描述Given a linked list, reverse the nodes of a linked list k at a time and return its modified list.If the number of nodes is not a multiple of k then 阅读全文