![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
python
文章平均质量分 89
听歌健身码代码
这个作者很懒,什么都没留下…
展开
-
欢迎使用CSDN-markdown编辑器
python包之间调用一般我们会将自己写的 Python 模块与 Python 自带的模块分开存放以达到便于维护的目的。调用可以分为二种:一、同一子目录下互相调用 如a调用b: 直接使用from b import xxx(*)即可二、调用父包同一目录下模块 如a1中调用b:方法一:在各个包目录下添加__init__.python文件让其成为包后才可调用。使用from原创 2017-10-25 09:23:12 · 133 阅读 · 0 评论 -
[lleetcode]初级算法——设计问题
打乱数组Shuffle a set of numbers without duplicates.Example:// Init an array with set 1, 2, and 3.int[] nums = {1,2,3};Solution solution = new Solution(nums);// Shuffle the array [1,2,3] and return it...原创 2018-06-20 13:28:40 · 153 阅读 · 0 评论 -
[leetcode]中级算法——数组和字符串
三数之和Given an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.Note:The solution set must not cont...原创 2018-06-27 16:41:33 · 158 阅读 · 0 评论 -
[leetcode]中级算法——其他
快乐数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 ...原创 2018-07-02 20:51:52 · 228 阅读 · 0 评论 -
[leetcode]中级算法——设计
二叉树的序列化和反序列化Serialization is the process of converting a data structure or object into a sequence of bits so that it can be stored in a file or memory buffer, or transmitted across a network connectio...原创 2018-07-02 22:12:58 · 223 阅读 · 0 评论 -
[leetcode]中级算法——链表
两数相加You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and retu...原创 2018-06-28 00:01:30 · 202 阅读 · 0 评论 -
[leetcode]中级算法——树和图
二叉树的中序遍历Given a binary tree, return the inorder traversal of its nodes' values.Example:Input: [1,null,2,3] 1 \ 2 / 3Output: [1,3,2]Code(By myself):# Definition for a binary tree n...原创 2018-06-28 23:40:22 · 251 阅读 · 0 评论 -
[leetcode]高级算法——数组和字符串
除自身以外数组的乘积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 nums[i].Example:Input: [1,2,3,4]Out...原创 2018-07-04 15:44:35 · 255 阅读 · 0 评论 -
[leetcode]高级算法——链表
合并K个排序链表Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.Example:Input:[ 1->4->5, 1->3->4, 2->6]Output: 1->1->2->3->...原创 2018-07-04 23:48:50 · 177 阅读 · 0 评论 -
[leetcode]高级算法——回溯算法
分割回文串Given a string s, partition s such that every substring of the partition is a palindrome.Return all possible palindrome partitioning of s.Example:Input: "aab"Output:[ ["aa","b"], ["a","a",".原创 2018-07-13 10:59:57 · 338 阅读 · 0 评论 -
[leetcode]初级算法——其他
位1的个数Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as the Hamming weight).For example, the 32-bit integer ’11' has binary representation 0000000...原创 2018-06-20 11:16:40 · 140 阅读 · 0 评论 -
[leetcode]初级算法——数学
Fizz BuzzWrite a program that outputs the string representation of numbers from 1 to n.But for multiples of three it should output “Fizz” instead of the number and for the multiples of five output “Bu...原创 2018-06-19 21:13:53 · 205 阅读 · 0 评论 -
[leetcode]中级算法——动态规划
跳跃游戏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 if yo...原创 2018-06-30 23:37:03 · 177 阅读 · 0 评论 -
[leetcode]初级算法——数组
Title:Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete as many transactions as you like (i.e., bu...原创 2018-05-26 15:28:50 · 226 阅读 · 0 评论 -
[leetcode]初级算法——字符串
反转字符串Write a function that takes a string as input and returns the string reversed.Example:Given s = "hello", return "olleh".Code(By myself):class Solution: def reverseString(self, s): """...原创 2018-06-15 14:13:38 · 256 阅读 · 0 评论 -
[leetcode]初级算法——链表
删除链表中的节点Write a function to delete a node (except the tail) in a singly linked list, given only access to that node.Example:Input: head = [4,5,1,9], node = 5Output: [4,1,9]Explanation: You are given...原创 2018-06-16 13:44:00 · 158 阅读 · 0 评论 -
[leetcode]初级算法——树
二叉树的最大深度Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.Note: A leaf is a node with no chi...原创 2018-06-17 15:23:04 · 130 阅读 · 0 评论 -
[leetcode]初级算法——排序和搜索
合并两个有序数组Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.Note:The number of elements initialized in nums1 and nums2 are m and n respectively.You may assume t...原创 2018-06-17 16:42:06 · 175 阅读 · 0 评论 -
[leetcode]初级算法——动态规划
爬楼梯You are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?Note: Given n will be a positive ...原创 2018-06-18 15:35:22 · 244 阅读 · 0 评论 -
[leetcode]中级算法——回溯算法
电话号码的字母组合Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on the telephone buttons)...原创 2018-06-29 23:24:40 · 319 阅读 · 0 评论 -
[leetcode]中级算法——排序和搜索
分类颜色Given an array with n objects colored red, white or blue, sort them in-place so that objects of the same color are adjacent, with the colors in the order red, white and blue.Here, we will use the ...原创 2018-06-30 16:00:28 · 825 阅读 · 0 评论 -
[leetcode]高级算法——树和图
被围绕的区域Given a 2D board containing 'X' and 'O' (the letter O), capture all regions surrounded by 'X'.A region is captured by flipping all 'O's into 'X's in that surrounded region.Example:X X X XX O O ...原创 2018-07-08 00:28:40 · 430 阅读 · 0 评论