自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 Ubuntu下载时有锁

在使用sudo apt-get install ......时出现E: 无法获得锁 /var/lib/dpkg/lock-frontend - open (11: 资源暂时不可用)E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?首先采...

2019-03-12 13:38:54 944 1

原创 [leetcode]-867. Transpose Matrix(C语言)

Given a matrix A, return the transpose of A.The transpose of a matrix is the matrix flipped over it's main diagonal, switching the row and column indices of the matrix.Example 1:Input: [[1,2,3]...

2018-09-20 11:06:23 898

原创 [leetcode]-905. Sort Array By Parity(C语言)

Given an array A of non-negative integers, return an array consisting of all the even elements of A, followed by all the odd elements of A.You may return any answer array that satisfies this conditi...

2018-09-20 00:28:00 849

原创 [leetcode]-665. Non-decreasing Array(C语言)

Given an array with n integers, your task is to check if it could become non-decreasing by modifying at most 1 element.We define an array is non-decreasing if array[i] <= array[i + 1] holds for e...

2018-09-20 00:22:50 314

原创 [leetcode]-896. Monotonic Array(C语言)

An array is monotonic if it is either monotone increasing or monotone decreasing.An array A is monotone increasing if for all i <= j, A[i] <= A[j].  An array A is monotone decreasing if for al...

2018-09-19 22:33:19 312

原创 [leetcode]-73. Set Matrix Zeroes(C语言)

Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in-place.Example 1:Input: [  [1,1,1],  [1,0,1],  [1,1,1]]Output: [  [1,0,1],  [0,0,0],  [1,0,1]]E...

2018-09-19 00:51:28 321

原创 [leetcode]-48. Rotate Image(C语言)

You are given an n x n 2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Note:You have to rotate the image in-place, which means you have to modify the input 2D matrix d...

2018-09-19 00:33:32 946

原创 [leetcode]-605. Can Place Flowers(C语言)

Suppose you have a long flowerbed in which some of the plots are planted and some are not. However, flowers cannot be planted in adjacent plots - they would compete for water and both would die.Give...

2018-09-18 13:38:16 184

原创 [leetcode]-357. Count Numbers with Unique Digits(C语言)

Given a non-negative integer n, count all numbers with unique digits, x, where 0 ≤ x < 10n.Example:Input: 2Output: 91 Explanation: The answer should be the total numbers in the range of 0 ≤ ...

2018-09-18 00:26:08 137

原创 [leetcode]-171. Excel Sheet Column Number(C语言)

Given a column title as appear in an Excel sheet, return its corresponding column number.For example: A -> 1 B -> 2 C -> 3 ... Z -> 26 AA -> 27 AB -> ...

2018-09-17 23:11:32 315

原创 [leetcode]-476. Number Complement(C语言)

Given a positive integer, output its complement number. The complement strategy is to flip the bits of its binary representation.Note:The given integer is guaranteed to fit within the range of a 3...

2018-08-28 23:27:18 305

原创 [leetcode]-892. Surface Area of 3D Shapes(C语言)

On a N * N grid, we place some 1 * 1 * 1 cubes.Each value v = grid[i][j] represents a tower of v cubes placed on top of grid cell (i, j).Return the total surface area of the resulting shapes. ...

2018-08-28 23:27:09 217

原创 [leetcode]-775. Global and Local Inversions(C语言)

We have some permutation A of [0, 1, ..., N - 1], where N is the length of A.The number of (global) inversions is the number of i < j with 0 <= i < j < N and A[i] > A[j].The number ...

2018-08-28 23:26:57 165

原创 [leetcode]-4. Median of Two Sorted Arrays(C语言)

There are two sorted arrays nums1 and nums2 of size m and n respectively.Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).You may assume nums1 and n...

2018-08-26 00:28:06 264

原创 [leetcode]-859. Buddy Strings(C语言)

Given two strings A and B of lowercase letters, return true if and only if we can swap two letters in A so that the result equals B. Example 1:Input: A = "ab", B = "ba"Output: trueExample 2...

2018-08-26 00:27:57 291

原创 [leetcode]-209. Minimum Size Subarray Sum(C语言)

Given an array of n positive integers and a positive integer s, find the minimal length of a contiguous subarray of which the sum ≥ s. If there isn't one, return 0 instead.Example: Input: s = 7, ...

2018-08-26 00:27:48 322

原创 [leetcode]-154. Find Minimum in Rotated Sorted Array II(C语言)

Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.(i.e.,  [0,1,2,4,5,6,7] might become  [4,5,6,7,0,1,2]).Find the minimum element.The array may contai...

2018-08-26 00:27:39 171

原创 [leetcode]-153. Find Minimum in Rotated Sorted Array(C语言)

Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.(i.e.,  [0,1,2,4,5,6,7] might become  [4,5,6,7,0,1,2]).Find the minimum element.You may assume no du...

2018-08-26 00:27:30 226

原创 [leetcode]-876. Middle of the Linked List(C语言)

Given a non-empty, singly linked list with head node head, return a middle node of linked list.If there are two middle nodes, return the second middle node. Example 1:Input: [1,2,3,4,5]Outpu...

2018-08-26 00:27:20 737

原创 [leetcode]-463. Island Perimeter(C语言)

You are given a map in form of a two-dimensional integer grid where 1 represents land and 0 represents water. Grid cells are connected horizontally/vertically (not diagonally). The grid is completely ...

2018-08-26 00:27:11 233

原创 [leetcode]-771. Jewels and Stones(C语言)

You're given strings J representing the types of stones that are jewels, and S representing the stones you have.  Each character in S is a type of stone you have.  You want to know how many of the sto...

2018-08-26 00:26:59 628

原创 [leetcode]-3. Longest Substring Without Repeating Characters(C语言)

Given a string, find the length of the longest substring without repeating characters.Example 1:Input: "abcabcbb"Output: 3 Explanation: The answer is "abc", which the length is 3.Example 2:...

2018-08-26 00:26:46 150

原创 [leetcode]-881. Boats to Save People(C语言)

The i-th person has weight people[i], and each boat can carry a maximum weight of limit.Each boat carries at most 2 people at the same time, provided the sum of the weight of those people is at most...

2018-08-26 00:26:35 235

原创 [leetcode]-532. K-diff Pairs in an Array(C语言)

Given an array of integers and an integer k, you need to find the number of unique k-diff pairs in the array. Here a k-diff pair is defined as an integer pair (i, j), where i and j are both numbers in...

2018-08-25 14:53:11 194

原创 [leetcode]-557. Reverse Words in a String III

Given a string, you need to reverse the order of characters in each word within a sentence while still preserving whitespace and initial word order.Example 1:Input: "Let's take LeetCode contest"...

2018-08-25 00:34:36 122

原创 [leetcode]-441. Arranging Coins(C语言)

You have a total of n coins that you want to form in a staircase shape, where every k-th row must have exactly k coins.Given n, find the total number of full staircase rows that can be formed.n is...

2018-08-25 00:31:27 167

原创 [leetcode]-628. Maximum Product of Three Numbers(C语言)

Given an integer array, find three numbers whose product is maximum and output the maximum product.Example 1:Input: [1,2,3]Output: 6 Example 2:Input: [1,2,3,4]Output: 24 Note:The...

2018-08-25 00:31:16 178

原创 [leetcode]-162. Find Peak Element(C语言)

A peak element is an element that is greater than its neighbors.Given an input array nums, where nums[i] ≠ nums[i+1], find a peak element and return its index.The array may contain multiple peaks,...

2018-08-25 00:31:05 260

原创 [leetcode]-81. Search in Rotated Sorted Array II(C语言)

Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.(i.e., [0,0,1,2,2,5,6] might become [2,5,6,0,0,1,2]).You are given a target value to search. If found ...

2018-08-25 00:30:56 134

原创 [leetcode]-33. Search in Rotated Sorted Array(C语言)

Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.(i.e., [0,1,2,4,5,6,7] might become [4,5,6,7,0,1,2]).You are given a target value to search. If found ...

2018-08-25 00:30:46 249

原创 [leetcode]-561. Array Partition I(C语言)

Given an array of 2n integers, your task is to group these integers into n pairs of integer, say (a1, b1), (a2, b2), ..., (an, bn) which makes sum of min(ai, bi) for all i from 1 to n as large as poss...

2018-08-25 00:30:36 201

原创 [leetcode]-169. Majority Element(C语言)

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 array is non-empty and the majority element alwa...

2018-08-25 00:30:26 284

原创 [leetcode]-58. Length of Last Word(C语言)

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 defin...

2018-08-25 00:30:12 173

原创 [leetcode]-264. Ugly Number II(C语言)

Write a program to find the n-th ugly number.Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. Example:Input: n = 10Output: 12Explanation: 1, 2, 3, 4, 5, 6, 8, 9, 10...

2018-08-24 11:53:25 312

原创 [leetcode]-263. Ugly Number(C语言)

Write a program to check whether a given number is an ugly number.Ugly numbers are positive numbers whose prime factors only include 2, 3, 5.Example 1:Input: 6Output: trueExplanation: 6 = 2 ×...

2018-08-24 11:11:02 435

原创 [leetcode]-202. Happy Number(C语言)

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 integer, replace the number by the sum of the squares o...

2018-08-24 11:02:10 1213

原创 [leetcode]-367. Valid Perfect Square(C语言)

Given a positive integer num, write a function which returns True if num is a perfect square else False.Note: Do not use any built-in library function such as sqrt.Example 1:Input: 16Returns: ...

2018-08-24 10:40:24 264

原创 [leetcode]-69. Sqrt(x)(C语言)

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 return type is an integer, the decimal digits are truncated and only...

2018-08-24 10:18:26 551

原创 [leetcode]-50. Pow(x, n)(C语言)

Implement pow(x, n), which calculates x raised to the power n (xn).Example 1:Input: 2.00000, 10Output: 1024.00000Example 2:Input: 2.10000, 3Output: 9.26100Example 3:Input: 2.00000, ...

2018-08-24 10:07:54 325 1

原创 [leetcode]-445. Add Two Numbers II(C语言)

You are given two non-empty linked lists representing two non-negative integers. The most significant digit comes first and each of their nodes contain a single digit. Add the two numbers and return i...

2018-08-24 09:23:59 190

空空如也

空空如也

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

TA关注的人

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