摘要:
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 intege... 阅读全文
posted @ 2017-11-17 22:28
wangyaning
阅读(191)
评论(0)
推荐(0)
摘要:
Given a sorted linked list, delete all duplicates such that each element appear only once. For example, Given 1->1->2, return 1->2. Given 1-... 阅读全文
posted @ 2017-11-17 22:28
wangyaning
阅读(149)
评论(0)
推荐(0)
摘要:
Maximum Depth of Binary Tree Total Accepted: 63668 Total Submissions: 141121 My Submissions Question Solution Given a binary tree, find it... 阅读全文
posted @ 2017-11-17 22:28
wangyaning
阅读(180)
评论(0)
推荐(0)
摘要:
Reverse digits of an integer.Example1: x = 123, return 321 Example2: x = -123, return -321 click to show spoilers.Have you thought about this?... 阅读全文
posted @ 2017-11-17 22:28
wangyaning
阅读(134)
评论(0)
推荐(0)
摘要:
Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. • push(x) – Push element x onto stack. • p... 阅读全文
posted @ 2017-11-17 22:28
wangyaning
阅读(182)
评论(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: A: ... 阅读全文
posted @ 2017-11-17 22:28
wangyaning
阅读(148)
评论(0)
推荐(0)
摘要:
Compare two version numbers version1 and version2. If version1 > version2 return 1, if version1 22; return 1.Example2: version1==”11.22.33”,... 阅读全文
posted @ 2017-11-17 22:28
wangyaning
阅读(186)
评论(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 t... 阅读全文
posted @ 2017-11-17 22:28
wangyaning
阅读(110)
评论(0)
推荐(0)
摘要:
Given an integer n, return the number of trailing zeroes in n!.Note: Your solution should be in logarithmic time complexity.解决思路: 决定阶乘末尾零的个数其实... 阅读全文
posted @ 2017-11-17 22:28
wangyaning
阅读(118)
评论(0)
推荐(0)
摘要:
Rotate an array of n elements to the right by k steps.For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to [5,6,7,1,2,3,... 阅读全文
posted @ 2017-11-17 22:28
wangyaning
阅读(124)
评论(0)
推荐(0)