自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(18)
  • 收藏
  • 关注

原创 证明题-8.12

8.12  The k-SPANNING TREE problem is the following.                           Input: An undirected graph G = (V,E)                           Output: Aspanningtreeof G in which each node has de

2017-07-08 01:04:32 216

原创 399 Evaluate Division

Equations are given in the format A / B = k, where A and B are variables represented as strings, and k is a real number (floating point number). Given some queries, return the answers. If the answ

2017-07-08 01:01:26 167

原创 349 Intersection of Two Arrays

Given two arrays, write a function to compute their intersection.Example:Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2].Note:Each element in the result must be unique.T

2017-07-08 00:54:23 143

原创 141 Linked List Cycle

Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?/** * Definition for singly-linked list. * struct ListNode { * int val; *

2017-07-07 11:12:10 150

原创 100 Same Tree

Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identical and the nodes have the same value./**

2017-07-07 10:43:53 144

原创 238 Product of Array Except Self

Given an array of n integers where n > 1, nums, return an array output such that output[i] is equal to the product of all the elements of nums except nums[i].Solve it without division and in O(n).For

2017-07-04 09:49:45 163

原创 50 Pow(x, n)

Implement pow(x, n).public class Solution { public double pow(double x, int n) { if(n == 0) return 1; if(n<0){ n = -n; x = 1/x; }

2017-07-04 09:31:57 126

原创 69 Sqrt(x)

Implement int sqrt(int x).Compute and return the square root of x.int sqrt(int x) { double ans = x; double delta = 0.0001; while (fabs(pow(ans, 2) - x) > delta) { ans = (an

2017-06-30 17:32:40 249

原创 58 Length of Last Word

Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the string.If the last word does not exist, return 0.Note: A word is

2017-06-30 15:15:06 118

原创 303 Range Sum Query - Immutable

Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive.Example:Given nums = [-2, 0, 3, -5, 2, -1]sumRange(0, 2) -> 1sumRange(2, 5) -> -1sumRan

2017-06-29 07:48:34 132

原创 139 Word Break

Given a non-empty string s and a dictionary wordDict containing a list of non-empty words, determine if s can be segmented into a space-separated sequence of one or more dictionary words. You may as

2017-06-29 01:02:18 180

原创 98 Validate Binary Search Tree

Given a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtree of a node contains only nodes with keys less than the node's key.Th

2017-06-29 00:32:51 127

原创 111 Minimum Depth of Binary Tree

Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node.Solution:/** * Definiti

2017-06-29 00:09:43 124

原创 376 Wiggle Subsequence

A sequence of numbers is called a wiggle sequence if the differences between successive numbers strictly alternate between positive and negative. The first difference (if one exists) may be either pos

2017-06-27 16:31:16 173

原创 134 Gas Station

There are N gas stations along a circular route, where the amount of gas at station i is gas[i].You have a car with an unlimited gas tank and it costs cost[i] of gas to travel from station i to

2017-06-27 15:24:48 207

原创 55 Jump Game

Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position.Determine i

2017-06-27 14:39:48 162

原创 1 Tow Sum

Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution, and you may not use the sam

2017-06-27 13:33:23 163

原创 12 Integer to Roman

public class Solution { public String intToRoman(int num) { String M[] = {"", "M", "MM", "MMM"}; String C[] = {"", "C", "CC", "CCC", "CD", "D", "DC", "DCC", "DCCC", "CM"};

2017-02-27 00:21:06 185

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除