自定义博客皮肤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的专栏

自律 自由

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

原创 【Javascript】leetcode 18.4Sum

Given an arraynumsofnintegers and an integertarget, are there elementsa,b,c, anddinnumssuch thata+b+c+d=target? Find all unique quadruplets in the array which gives the sum oftarget.Note:The solution set must not contain duplicat...

2020-05-11 22:10:11 243

原创 【Javascript】leetcode 15. 3Sum

Given an arraynumsofnintegers, are there elementsa,b,cinnumssuch thata+b+c= 0? Find all unique triplets in the array which gives the sum of zero.Note:The solution set must not contain duplicate triplets.Example:Given array nums = ...

2020-05-11 20:11:29 211

原创 【matplotlib】解决中文变成框的显示问题

环境:macos anaconda3/python3.6参考:1matplotlib图例中文乱码?1 下载中文字体SimHei2 将下载好的simhei字体文件SimHei.ttf拷贝到matplotlib字体文件夹(matplotlib/mpl-data/fonts/ttf)里这里要查找你使用的matplotlib的pakage是下载到了哪里,可以在python中通过使用...

2019-11-17 21:27:04 582

原创 【ubuntu16.04服务器登陆配置】新建管理员用户、禁用root登陆、密钥登陆配置

需求:快速安全进入服务器的配置我在阿里云上购买了一台轻量应用服务器,使用ssh密码登陆很费时,以及用root用户操作涉及很多后患,所以需要进行无密登陆、新增管理员用户等操作的配置服务器配置:ubuntu16.04本地:maxos 10.12.16ssh登陆方式:$ssh -p 22 root@xx.xx.xx.xx 输入密码即可进入服务器(如果你的本地ssh都没有,请先安...

2019-06-23 12:03:39 762

原创 django 静态文件404配置

参考:https://code.ziqiangxuetang.com/django/django-static-files.html1 确保setting.py:INSTALLED_APPS里有'django.contrib.staticfiles',2STATIC_URL = '/static/'STATICFILES_DIRS = ( os.path.join(B...

2019-05-23 17:54:54 3307

原创 【pandas】get_dummies对特征进行onehot encoder测试集特征的一致性等坑

在对分类特征进行处理时,我们经常会把这类特征转成独热编码(onehot)在sklearn中有OneHotEncoder,但是使用比较麻烦,万幸是pandas有对应的get_dummiespandas.get_dummies(data,prefix=None,prefix_sep='_',dummy_na=False,columns=None,sparse=False,drop...

2019-03-16 15:29:32 3680 3

原创 【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 275

原创 【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 323

原创 【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 255

原创 【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 260

原创 【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 187

原创 【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 300

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

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

2019-01-16 14:05:05 10800 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 213

原创 【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 225

原创 【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 206

原创 【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 301

原创 【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 150

原创 【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 211

原创 【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 159

原创 【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 223

原创 【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 218

原创 【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 217

原创 【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 224

原创 【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 172

原创 【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 221

原创 【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 462

原创 【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 332

原创 【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 197

原创 【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 137

原创 【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 256

原创 【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 275

原创 【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 192

原创 【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 144

原创 【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 143

原创 【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 183

原创 【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 162

原创 【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 170

原创 【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 289

原创 【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 301

空空如也

空空如也

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

TA关注的人

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