随笔分类 -  剑指offer

摘要:Given a linked list, return the node where the cycle begins. If there is no cycle, return null. To represent a cycle in the given linked list, we use 阅读全文
posted @ 2019-03-19 20:37 月半榨菜 阅读(152) 评论(0) 推荐(0)
摘要:Reverse a singly linked list. Example: Follow up:A linked list can be reversed either iteratively or recursively. Could you implement both? 递归 进阶题 两两交 阅读全文
posted @ 2019-02-25 09:54 月半榨菜 阅读(120) 评论(0) 推荐(0)
摘要:Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. You may assume that the 阅读全文
posted @ 2019-02-25 09:52 月半榨菜 阅读(99) 评论(0) 推荐(0)
摘要:Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest le 阅读全文
posted @ 2019-02-25 09:46 月半榨菜 阅读(102) 评论(0) 推荐(0)
摘要: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 ways can you cli 阅读全文
posted @ 2019-02-25 09:45 月半榨菜 阅读(105) 评论(0) 推荐(0)
摘要:Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum. Example: Foll 阅读全文
posted @ 2019-02-25 09:43 月半榨菜 阅读(122) 评论(0) 推荐(0)