04 2020 档案
摘要:题目 编写一个算法来判断一个数 n 是不是快乐数。 「快乐数」定义为:对于一个正整数,每一次将该数替换为它每个位置上的数字的平方和,然后重复这个过程直到这个数变为 1,也可能是 无限循环 但始终变不到 1。如果 可以变为 1,那么这个数就是快乐数。 如果 n 是快乐数就返回 True ;不是,则返回
阅读全文
摘要:"Java入门笔记目录" [TOC] 数据类型与变量 变量和标识符 1. 变量声明和赋值与C++一致,注意float 2. 标识符:字母、数字、下划线、美元符号组成,不可以用数字开头 3. Java书写习惯:类名首字母大写;包名、方法名、变量名都要小写(camel);少用下划线;常量随用随定义 数据
阅读全文
摘要:命题概念 基础概念 具有确切真值的陈述句是命题,命题只有真假和两种 用带或不带下标的英文字母表示命题 原子命题和符合命题 原子命题是不可拆分的命题,原子命题通过连接词连接成为复合命题 连接词 1. 否定联结词 ${\neg}$ 2. 合取联结词 ${\wedge}$ 3. 析取联结词 ${\vee}
阅读全文
摘要:1. 朴素集合论(康托尔) 理发师悖论 2. 公理化集合论:外延公理+空集存在公理+无序对公理+并集公理+幂集公理+无穷公理+替换公理+正则公理+选择公理(ZFC公理化集合论) 集合概念 1. 用带或不带下标的大写字母和下标表示集合,用带或不带下标的小写字母表示元素 2. 常见集合:自然数集合N,整
阅读全文
摘要:题目 (这是一个 交互式问题 ) 给你一个 山脉数组 mountainArr,请你返回能够使得 mountainArr.get(index) 等于 target 最小 的下标 index 值。 如果不存在这样的下标 index,就请返回 1。 何为山脉数组?如果数组 A 是一个山脉数组的话,那它满足
阅读全文
摘要:python爬虫基础 python爬虫基础(一)基础信息 python爬虫基础(二)Request库
阅读全文
摘要:相关内容: "requests文档" 、 "Python 爬虫知识清单【更】" 安装使用 1. 安装 2. 测试 3. 使用逻辑:发出一个request对象,得到返回的response对象 4. 适用规模:小规模,爬取速度不敏感的任务 5. 主要方法:request、get、head、post、pu
阅读全文
摘要:相关内容: "python爬虫知识清单【更】" 基础知识 1. request库:自动爬取HTML页面。自动网络请求提交 2. robots.txt:网络爬虫排除标准 3. Beautiful soup:解析HTML页面 4. RE:正则表达式提取重要信息 5. scrapy:网络爬虫框架 开发工具
阅读全文
摘要:基础 linux 发行版 1. slackware:SUSE Linux Enterprise Server 2. debian:ubuntu,mint 3. RedHat:RHEL RedHat Enterprise Linux CentOS 中标麒麟 Fedora 4. ArchLinux:轻量
阅读全文
摘要:题目 实现获取下一个排列的函数,算法需要将给定数字序列重新排列成字典序中下一个更大的排列。 如果不存在下一个更大的排列,则将数字重新排列成最小的排列(即升序排列)。 必须原地修改,只允许使用额外常数空间。 以下是一些例子,输入位于左侧列,其相应输出位于右侧列。 → `3,2,1 1,2,3` → 来
阅读全文
摘要:题目 实现 strStr() 函数。 给定一个 haystack 字符串和一个 needle 字符串,在 haystack 字符串中找出 needle 字符串出现的第一个位置 (从0开始)。如果不存在,则返回 1。 示例 1: 示例 2: 说明: 当 needle 是空字符串时,我们应当返回什么值呢
阅读全文
摘要:题目 给你一个数组 nums 和一个值 val,你需要 原地 移除所有数值等于 val 的元素,并返回移除后数组的新长度。 不要使用额外的数组空间,你必须仅使用 O(1) 额外空间并 原地 修改输入数组。 元素的顺序可以改变。你不需要考虑数组中超出新长度后面的元素。 示例 1: 示例 2: 来源:力
阅读全文
摘要:题目 给定一个排序数组,你需要在 原地 删除重复出现的元素,使得每个元素只出现一次,返回移除后数组的新长度。 不要使用额外的数组空间,你必须在 原地 修改输入数组 并在使用 O(1) 额外空间的条件下完成。 示例 1: 示例 2: 说明: 为什么返回数值是整数,但输出的答案是数组呢? 请注意,输入数
阅读全文
摘要:题目 给你一个链表,每 k 个节点一组进行翻转,请你返回翻转后的链表。 k 是一个正整数,它的值小于或等于链表的长度。 如果节点总数不是 k 的整数倍,那么请将最后剩余的节点保持原有顺序。 示例: 说明: 你的算法只能使用常数的额外空间。 你不能只是单纯的改变节点内部的值,而是需要实际进行节点交换。
阅读全文
摘要:题目 假设按照升序排序的数组在预先未知的某个点上进行了旋转。 ( 例如,数组 [0,1,2,4,5,6,7] 可能变为 [4,5,6,7,0,1,2] )。 搜索一个给定的目标值,如果数组中存在这个目标值,则返回它的索引,否则返回 1 。 你可以假设数组中不存在重复的元素。 你的算法时间复杂度必须是
阅读全文
摘要:题目 给定一个链表,两两交换其中相邻的节点,并返回交换后的链表。 你不能只是单纯的改变节点内部的值,而是需要实际的进行节点交换。 示例: 来源:力扣(LeetCode) 链接:https://leetcode cn.com/problems/swap nodes in pairs 解法 解题思路 对
阅读全文
摘要:题目 Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. 合并 k 个排序链表,返回合并后的排序链表。请分析和描述算法的复杂度。 Example: 解法
阅读全文
摘要:题目 Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists. 将两个升序
阅读全文
摘要:题目 Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. An input string is valid if:
阅读全文
摘要:题目 Given a linked list, remove the n th node from the end of list and return its head. 给定一个链表,删除链表的倒数第 n 个节点,并且返回链表的头结点。 Example: Note: Given n will a
阅读全文
摘要:题目 Given an array nums of n integers and an integer target, are there elements a, b, c, and d in nums such that a + b + c + d = target? Find all uniqu
阅读全文
摘要:题目 Given a string containing digits from 2 9 inclusive, return all possible letter combinations that the number could represent. A mapping of digit to
阅读全文
摘要:题目 Given an array nums of n integers and an integer target, find three integers in nums such that the sum is closest to target. Return the sum of the
阅读全文
摘要:题目 硬币。给定数量不限的硬币,币值为25分、10分、5分和1分,编写代码计算n分有几种表示法。(结果可能会很大,你需要将结果模上1000000007) 示例1: 示例2: 来源:力扣(LeetCode) 链接:https://leetcode cn.com/problems/coin lcci 解
阅读全文
摘要:题目 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 th
阅读全文
摘要:题目 Write a function to find the longest common prefix string amongst an array of strings. If there is no common prefix, return an empty string "". 编写一
阅读全文
摘要:题目 Given a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom. 给定一棵
阅读全文
摘要:题目 Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M. 罗马数字包含以下七种字符: I, V, X, L,C,D 和 M。 For example, two is written as
阅读全文
摘要:题目 Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M. 罗马数字包含以下七种字符: I, V, X, L,C,D 和 M。 For example, two is written as
阅读全文
摘要:题目 Given n non negative integers a1, a2, ..., an , where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two e
阅读全文
摘要:题目 Given an array of integers nums and an integer k. A subarray is called nice if there are k odd numbers on it. Return the number of nice sub arrays.
阅读全文
摘要:题目 Given a 2d grid map of '1's (land) and '0's (water), count the number of islands. An island is surrounded by water and is formed by connecting adja
阅读全文
摘要:题目 给你一个字符串 s 和一个字符规律 p,请你来实现一个支持 '.' 和 ' ' 的正则表达式匹配。 所谓匹配,是要涵盖 整个 字符串 s的,而不是部分字符串。 Example1 Example2 Example3 Example4 Example5 来源:力扣(LeetCode) 链接:htt
阅读全文
摘要:题目 Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward. Follow up: Coud you solve it w
阅读全文
摘要:题目 Implement atoi which converts a string to an integer. The function first discards as many whitespace characters as necessary until the first non wh
阅读全文
摘要:题目 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 ma
阅读全文
摘要:Java入门笔记(一)基本信息 Java入门笔记(二)输入与输出 Java入门笔记(三)数据类型与基本语法 Java入门笔记(四)类、包和接口 Java入门笔记(五)java深入理解 Java入门笔记(六)异常处理
阅读全文
摘要:"Java入门笔记目录" [TOC] 基础信息 1. 官方网站 java.sun.com (重定向到oracle) 2. 三大平台:SE EE ME 3. java的推动力:JCP和JSR 规范 java语言特点 1. 面向对象的语言 OOP 2. 平台无关性:编译结果可以运行到不同平台上 3. 安
阅读全文
摘要:题目 Given a 32 bit signed integer, reverse digits of an integer. Assume we are dealing with an environment which could only store integers within the 3
阅读全文
摘要:题目 The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed fo
阅读全文
摘要:题目 Given a collection of intervals, merge all overlapping intervals. 给出一个区间的集合,请合并所有重叠的区间。 Example1 Example2 来源:力扣(LeetCode) 链接:https://leetcode.com/p
阅读全文
摘要:题目 Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. 给定一个字符串 s,找到 s 中最长的回文子串。你可以假设 s
阅读全文
摘要:1-500 1-100 【简单】1-两数之和 Two Sum 【中等】2-两数相加 Add Two Num 【中等】3-无重复字符的最长子串 Longest Substring Without Repeating Characters 【困难】4-寻找两个有序数组的中位数 Median of Two
阅读全文
摘要:题目 Given a matrix consists of 0 and 1, find the distance of the nearest 0 for each cell. The distance between two adjacent cells is 1. 1. The number o
阅读全文
摘要:基础概念 python基本信息 1. python之父是荷兰人 Guido van Rossum 2. python提供完善的基础代码库,覆盖网络、文件、GUI、数据库、文本等大量的内容 3. 除了内置库,python还有大量的第三方库 4. python适合应用 网络应用(网站、后台服务) 日常小
阅读全文
摘要:题目 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 con
阅读全文
摘要:题目 Given a string, find the length of the longest substring without repeating characters. 给定一个字符串,请你找出其中不含有重复字符的 最长子串 的长度。 Example1 Example2 Example3
阅读全文
摘要:题目重述 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 complexi
阅读全文
摘要:题目重述 You are given two non empty linked lists representing two non negative integers. The most significant digit comes first and each of their nodes c
阅读全文
摘要:动态规划在计算机中是一个比较玄学的算法,有的人可能看很久都很疑惑这到底是怎么回事,但是一旦理解了,上手就非常容易了。 算法描述 (以下内容来自百度百科)动态规划(dynamic programming)是运筹学的一个分支,是求解决策过程(decision process)最优化的数学方法。20世纪5
阅读全文
摘要:回溯法在生活中其实是十分常见的,比如在9*9数独游戏中,我们根据同行、同列,同块中不能出现重复数字的原则补充未完成的表格,当有依据地推理出所有可以填写的空格时,经常会遇到某些不确定的格子,这些格子总是具有多选1的情况,此时,我们需要首先代入一个选项,并继续推理下去,当同行同列不重复的原则出现矛盾时,
阅读全文
摘要:题目重述 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 ha
阅读全文
摘要:使用动态规划、回溯法求解Leetcode第22题-括号生成问题。
Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.
数字 n 代表生成括号的对数,请你设计一个函数,用于能够生成所有可能的并且有效的括号组合。
阅读全文

浙公网安备 33010602011771号