随笔分类 - LeetCode
LeetCode做题思路。菜鸟一枚,不喜勿喷,谢谢。
摘要:题目:删除有序链表中的重复元素(难度:简单) Given a sorted linked list, delete all duplicates such that each element appear only once. 思路 应该属于链表的基本操作。因为链表是有序的,那么只需从头遍历,跳过相
阅读全文
摘要:题目:爬楼梯(难度:简单) You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many distinct w
阅读全文
摘要:题目:求x的平方根(难度:简单) Implement int sqrt(int x). Compute and return the square root of x, where x is guaranteed to be a non negative integer. Since the ret
阅读全文
摘要:题目:二进制求和(难度:简单) Given two binary strings, return their sum (also a binary string). The input strings are both non empty and contains only characters 1
阅读全文
摘要:题目:加一(难度:简单) Given a non empty array of digits representing a non negative integer, plus one to the integer. The digits are stored such that the most
阅读全文