自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

momottyy的专栏

自律 自由

  • 博客(52)
  • 收藏
  • 关注

原创 【python3】leetcode 153. Find Minimum in Rotated Sorted Array(Medium)

153. Find Minimum in Rotated Sorted Array(Medium)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...

2019-01-24 10:52:02 236

原创 【python3】leetcode 34. Find First and Last Position of Element in Sorted Array(Medium)

34. Find First and Last Position of Element in Sorted Array(Medium)Given an array of integers nums sorted in ascending order, find the starting and ending position of a given target value.Your al...

2019-01-20 21:19:16 271

原创 【python3】从leetcode 744 & 367 & 74 & 240 &33 & 69 &29 & 441讲解二分搜索

  目录二分搜索模版744. Find Smallest Letter Greater Than Target367. Valid Perfect Square74. Search a 2D Matrix240. Search a 2D Matrix II33. Search in Rotated Sorted Array69. Sqrt(x)29. D...

2019-01-18 14:16:07 236

原创 【python3】从leetcode 114 & 589 讲解关于树的先序遍历题

先序遍历 preorder遍历顺序:根结点-左子树-右子树,如下图蓝色为先序(4个算法的遍历结果都为12345)1 递归写法 def pretraversal(root): preval.append(root.val) if root.left:pretraversal(root.left)...

2019-01-17 14:46:08 236

原创 【python3】从leetcode 102& 104 & 559 & 429 &111 讲解关于树的层序遍历题

树的结点定义# Definition for a Node.class Node(object): def __init__(self, val, children): self.val = val self.children = children二叉树结点定义# Definition for a binary tree node.cl...

2019-01-17 10:02:27 163

原创 【python3】leetcode 82. Remove Duplicates from Sorted List II (Medium)

82. Remove Duplicates from Sorted List II (Medium)Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list.Example 1:Input...

2019-01-16 15:49:34 253

原创 【mac】修改mac默认终端和样式

系统macos 10.12.6相信很多使用mac的程序员 对mac自带的terminal终端样式诟病已久,因为自带终端字体太小无法放大 (在写这个教程的时候我发现自带终端通过左上角菜单栏-偏好设置-找到字体更改 也可以放大字体啦),而且没有高亮括号匹配等等特效,对程序员而言始终不是很高效,所以我今天尝试改了一下终端样式,又get到一项(无用)技能呢~修改样式后如下,4不4很可爱呢(咦为...

2019-01-16 14:05:05 10616 1

原创 【python3】leetcode 86. Partition List (Medium)

 86. Partition List (Medium)Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x.You should preserve the original relative ...

2019-01-15 16:38:43 179

原创 【python3】leetcode 143. Reorder List(Medium)

143. Reorder List(Medium)Given a singly linked list L: L0→L1→…→Ln-1→Ln,reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→…You may not modify the values in the list's nodes, only nodes itself may be changed....

2019-01-15 10:30:52 202

原创 【python3】leetcode 500. Keyboard Row (easy)

500. Keyboard Row (easy)Given a List of words, return the words that can be typed using letters of alphabet on only one row's of American keyboard like the image below.  Example:Input: ["...

2019-01-15 08:51:16 188

原创 【python3】leetcode 61. Rotate List (Medium)

61. Rotate List (Medium) Given a linked list, rotate the list to the right by k places, where k is non-negative.Example 1:Input: 1->2->3->4->5->NULL, k = 2Output: 4->5->1...

2019-01-14 20:12:03 277

原创 【python3】leetcode 442. Find All Duplicates in an Array (Medium)

442. Find All Duplicates in an Array (Medium) Given an array of integers, 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once.Find all the elements that appear twi...

2019-01-14 17:27:59 136

原创 【python3】leetcode 228. Summary Ranges (Medium)

228. Summary Ranges (Medium) Given a sorted integer array without duplicates, return the summary of its ranges.Example 1:Input: [0,1,2,4,5,7]Output: ["0->2","4->5","7"]Explanation: 0,...

2019-01-14 17:00:51 182

原创 【python3】leetcode 56. Merge Intervals (Medium)

 56. Merge Intervals (Medium)Given a collection of intervals, merge all overlapping intervals.Example 1:Input: [[1,3],[2,6],[8,10],[15,18]]Output: [[1,6],[8,10],[15,18]]Explanation: Since in...

2019-01-14 16:04:13 146

原创 【python3】leetcode 238. Product of Array Except Self (Medium)

238. Product of Array Except Self (Medium) Given an array nums of n integers where n > 1,  return an array output such that output[i] is equal to the product of all the elements of nums except n...

2019-01-14 15:34:47 205

原创 【python3】leetcode 643. Maximum Average Subarray I(easy)

 643. Maximum Average Subarray I(easy)Given an array consisting of n integers, find the contiguous subarray of given length k that has the maximum average value. And you need to output the maximum ...

2019-01-14 09:02:15 197

原创 【python3】leetcode 26. Remove Duplicates from Sorted Array(easy)

26. Remove Duplicates from Sorted Array(easy) Given a sorted array nums, remove the duplicates in-place such that each element appear only onceand return the new length.Do not allocate extra spac...

2019-01-13 23:58:59 198

原创 【python3】leetcode 976. Largest Perimeter Triangle(easy)

 976. Largest Perimeter Triangle(easy)Given an array A of positive lengths, return the largest perimeter of a triangle with non-zero area, formed from 3 of these lengths.If it is impossible to fo...

2019-01-13 23:24:47 193

原创 【python3】leetcode 717. 1-bit and 2-bit Characters (easy)

717. 1-bit and 2-bit Characters (easy) We have two special characters. The first character can be represented by one bit 0. The second character can be represented by two bits (10 or 11).Now give...

2019-01-13 22:37:25 151

原创 【python3】leetcode 766. Toeplitz Matrix(easy)

766. Toeplitz Matrix(easy)A matrix is Toeplitz if every diagonal from top-left to bottom-right has the same element.Now given an M x N matrix, return True if and only if the matrix is Toeplitz. ...

2019-01-13 20:33:20 189

原创 【python3】leetcode 509. Fibonacci Number(easy)

509. Fibonacci Number(easy)The Fibonacci numbers, commonly denoted F(n) form a sequence, called the Fibonacci sequence, such that each number is the sum of the two preceding ones, starting from 0 a...

2019-01-13 19:45:46 434

原创 【python3】leetcode 725. Split Linked List in Parts (Medium)

725. Split Linked List in Parts (Medium) Given a (singly) linked list with head node root, write a function to split the linked list into kconsecutive linked list "parts".The length of each part ...

2019-01-11 15:19:40 283

原创 【python3】leetcode 8. String to Integer (atoi) (Meidum)

8. String to Integer (atoi) (Meidum) Given two integers dividend and divisor, divide two integers without using multiplication, division and mod operator.Return the quotient after dividing divide...

2019-01-10 20:45:20 179

原创 【python3】leetcode 19. Remove Nth Node From End of List (Medium)

19. Remove Nth Node From End of List (Medium) Given a linked list, remove the n-th node from the end of list and return its head.Example:Given linked list: 1->2->3->4->5, and n = 2...

2019-01-10 19:41:20 115

原创 【python3】leetcode 453. Minimum Moves to Equal Array Elements(easy)

453. Minimum Moves to Equal Array Elements(easy)Given a non-empty integer array of size n, find the minimum number of moves required to make all array elements equal, where a move is incrementing n...

2019-01-10 15:07:06 228

原创 【python3】leetcode 883. Projection Area of 3D Shapes(easy)

883. Projection Area of 3D Shapes(easy) On a N * N grid, we place some 1 * 1 * 1 cubes that are axis-aligned with the x, y, and z axes.Each value v = grid[i][j] represents a tower of v cubes plac...

2019-01-10 13:38:56 234

原创 【python3】leetcode 171. Excel Sheet Column Number (easy)

171. Excel Sheet Column Number (easy)Given a column title as appear in an Excel sheet, return its corresponding column number.For example: A -> 1 B -> 2 C -> 3 ... ...

2019-01-10 10:01:08 172

原创 【python3】leetcode 868. Binary Gap(easy)

 868. Binary Gap(easy)Given a positive integer N, find and return the longest distance between two consecutive 1's in the binary representation of N.If there aren't two consecutive 1's, return 0....

2019-01-10 09:27:20 131

原创 【python3】leetcode 9. Palindrome Number(easy)

 9. Palindrome Number(easy)Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward.Example 1:Input: 121Output: trueExample 2:...

2019-01-10 08:23:17 133

原创 【python3】leetcode 728. Self Dividing Numbers (easy)

728. Self Dividing Numbers (easy)A self-dividing number is a number that is divisible by every digit it contains.For example, 128 is a self-dividing number because 128 % 1 == 0, 128 % 2 == 0, and...

2019-01-09 21:09:27 162

原创 【python3】leetcode 846. Hand of Straights (Medium)

846. Hand of StraightsAlice has a hand of cards, given as an array of integers.Now she wants to rearrange the cards into groups so that each group is size W, and consists of Wconsecutive cards....

2019-01-09 20:36:05 145

原创 【python3】leetcode 231. Power of Two (easy)

231. Power of Two (easy)Given an integer, write a function to determine if it is a power of two.Example 1:Input: 1Output: true Explanation: 20 = 1Example 2:Input: 16Output: trueExpla...

2019-01-09 17:49:26 143

原创 【python3】leetcode 707. Design Linked List (easy)

707. Design Linked List (easy) Design your implementation of the linked list. You can choose to use the singly linked list or the doubly linked list. A node in a singly linked list should have two ...

2019-01-09 11:10:53 261

原创 【python3】leetcode 445. Add Two Numbers II (Medium)

 445. Add Two Numbers IIYou 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 t...

2019-01-09 08:57:56 285

原创 【python3】leetcode 148. Sort List (Medium)

 148. Sort List (Medium)Sort a linked list in O(n log n) time using constant space complexity.Example 1:Input: 4->2->1->3Output: 1->2->3->4Example 2:Input: -1->5-&g...

2019-01-09 08:33:42 147

原创 【python3】leetcode 160. Intersection of Two Linked Lists(easy)

160. Intersection of Two Linked Lists(easy) 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...

2019-01-08 16:21:59 201

原创 【python3】leetcode 141. Linked List Cycle (easy)

141. Linked List Cycle (easy) Given a linked list, determine if it has a cycle in it.To represent a cycle in the given linked list, we use an integer pos which represents the position (0-indexed)...

2019-01-08 15:38:57 290

原创 【python3】leetcode 234. Palindrome Linked List (Easy)

234. Palindrome Linked List (Easy)Given a singly linked list, determine if it is a palindrome.Example 1:Input: 1->2Output: falseExample 2:Input: 1->2->2->1Output: trueFoll...

2019-01-08 14:59:43 154

原创 【python3】leetcode 203. Remove Linked List Elements (easy)

203. Remove Linked List Elements (easy)Remove all elements from a linked list of integers that have value val.Example:Input: 1->2->6->3->4->5->6, val = 6Output: 1->2-&gt...

2019-01-08 14:19:37 238

原创 【python3】leetcode 328. Odd Even Linked List(Medium)

328. Odd Even Linked List(Medium)Given a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the node number and not the value in the ...

2019-01-08 09:19:16 138

空空如也

空空如也

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

TA关注的人

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