
leetcode
张小白不白
博采众长,厚积薄发
展开
-
leetcode 第9题判断回文数的两种方法对比
dfd原创 2019-07-26 12:17:54 · 265 阅读 · 0 评论 -
二分查找求解单调递增序列的解
二分查找求解单调递增函数的解 题目(欧拉45题) Triangle, pentagonal, and hexagonal numbers are generated by the following formulae: Triangle Tn=n(n+1)/2 1, 3, 6, 10, 15, … Pentagonal Pn=n(3n−1)/2 1, 5, 12, 22, 35, ...原创 2019-07-28 20:13:48 · 512 阅读 · 0 评论 -
202.快乐数
题目 Write an algorithm to determine if a number is “happy”. A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of the squares...原创 2019-10-05 14:50:55 · 112 阅读 · 0 评论 -
203.删除链表指定元素
题目 Remove all elements from a linked list of integers that have value val. Example: Input: 1->2->6->3->4->5->6, val = 6 Output: 1->2->3->4->5 分析 本题属于典型的链表节点删除题目,使用虚拟头节...原创 2019-10-05 19:03:11 · 125 阅读 · 0 评论 -
206.链表的翻转
题目 Reverse a singly linked list. Example: Input: 1->2->3->4->5->NULL Output: 5->4->3->2->1->NULL 分析 定义虚拟头节点以及p,q两个指针变量,完成每一步的翻转操作 这里的虚拟头节点ret并没有指向head,而是充当了中间过度变量的作用 代...原创 2019-10-05 21:08:09 · 116 阅读 · 0 评论 -
287.寻找重复数字
题目 Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one duplicate number must exist. Assume that there is only one duplicate number,...原创 2019-10-06 17:15:58 · 137 阅读 · 0 评论