上一页 1 2 3 4 5 6 7 8 ··· 13 下一页
摘要: Given a list, rotate the list to the right by k places, where k is non-negative. Example: Tips:右移结点,过程如下: k=2,右移两次: ①5->1->2->3->4 ②4->5->1->2->3 思路:( 阅读全文
posted @ 2018-02-14 16:13 于淼 阅读(116) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2018-02-14 00:36 于淼 阅读(107) 评论(0) 推荐(0) 编辑
摘要: You are given coins of different denominations and a total amount of money amount. Write a function to compute the fewest number of coins that you nee 阅读全文
posted @ 2018-02-12 23:10 于淼 阅读(152) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree. According to the definition of LCA on Wikipedia: “The lowes 阅读全文
posted @ 2018-02-11 22:20 于淼 阅读(194) 评论(0) 推荐(0) 编辑
摘要: Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST. According to the definition of LCA on Wikipedia 阅读全文
posted @ 2018-02-11 16:13 于淼 阅读(141) 评论(0) 推荐(0) 编辑
摘要: Write a program to find the node at which the intersection of two singly linked lists begins. For example, the following two linked lists: begin to in 阅读全文
posted @ 2018-02-11 12:56 于淼 阅读(129) 评论(0) 推荐(0) 编辑
摘要: Question: Given a binary tree, determine if it is height-balanced. For this problem, a height-balanced binary tree is defined as: a binary tree in whi 阅读全文
posted @ 2018-02-09 20:31 于淼 阅读(127) 评论(0) 推荐(0) 编辑
摘要: Given a list of non negative integers, arrange them such that they form the largest number. For example, given [3, 30, 34, 5, 9], the largest formed n 阅读全文
posted @ 2018-02-07 22:04 于淼 阅读(128) 评论(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 @ 2018-02-07 12:30 于淼 阅读(124) 评论(3) 推荐(1) 编辑
摘要: Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum. For example: Given the below binary tree and su 阅读全文
posted @ 2018-02-06 22:35 于淼 阅读(149) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 ··· 13 下一页