09 2018 档案

摘要:Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum. Example: Inpu 阅读全文
posted @ 2018-09-30 22:02 静静地挖坑 阅读(316) 评论(0) 推荐(0)
摘要:Given an array nums and a value val, remove all instances of that value in-place and return the new length. Do not allocate extra space for another ar 阅读全文
posted @ 2018-09-30 18:41 静静地挖坑 阅读(148) 评论(0) 推荐(0)
摘要:Given a non-negative integer numRows, generate the first numRows of Pascal's triangle. Example: 原题地址: Pascal's Triangle 难度: Easy 题意: 杨辉三角 时间复杂度: O(n) 阅读全文
posted @ 2018-09-30 18:27 静静地挖坑 阅读(119) 评论(0) 推荐(0)
摘要:Given an unsorted array of integers, find the length of longest continuous increasing subsequence (subarray). Example 1: 题目地址: Longest Continuous Incr 阅读全文
posted @ 2018-09-30 18:10 静静地挖坑 阅读(142) 评论(0) 推荐(0)
摘要:On a staircase, the i-th step has some non-negative cost cost[i] assigned (0 indexed). Once you pay the cost, you can either climb one or two steps. Y 阅读全文
posted @ 2018-09-30 17:48 静静地挖坑 阅读(361) 评论(0) 推荐(0)
摘要:Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to complete at most one transaction 阅读全文
posted @ 2018-09-30 12:38 静静地挖坑 阅读(177) 评论(0) 推荐(0)
摘要:Given an integer array, find three numbers whose product is maximum and output the maximum product. Note: 原题地址: Maximum Product of Three Numbers 难度: E 阅读全文
posted @ 2018-09-30 11:57 静静地挖坑 阅读(148) 评论(0) 推荐(0)
摘要:In a string S of lowercase letters, these letters form consecutive groups of the same character. For example, a string like S = "abbxxxxzyy" has the g 阅读全文
posted @ 2018-09-30 11:34 静静地挖坑 阅读(199) 评论(0) 推荐(0)
摘要:Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array. 原题地址: Missing Number 难度: Easy 题意 阅读全文
posted @ 2018-09-30 11:00 静静地挖坑 阅读(125) 评论(0) 推荐(0)
摘要:Given a 2D integer matrix M representing the gray scale of an image, you need to design a smoother to make the gray scale of each cell becomes the ave 阅读全文
posted @ 2018-09-30 00:14 静静地挖坑 阅读(144) 评论(0) 推荐(0)
摘要:Given a non-empty array of non-negative integers nums, the degree of this array is defined as the maximum frequency of any one of its elements. Your t 阅读全文
posted @ 2018-09-29 23:50 静静地挖坑 阅读(313) 评论(0) 推荐(0)
摘要:Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number. The function 阅读全文
posted @ 2018-09-29 23:22 静静地挖坑 阅读(158) 评论(0) 推荐(0)
摘要: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). N 阅读全文
posted @ 2018-09-29 22:57 静静地挖坑 阅读(196) 评论(0) 推荐(0)
摘要:Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the arr 阅读全文
posted @ 2018-09-29 20:51 静静地挖坑 阅读(144) 评论(0) 推荐(0)
摘要: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 comple 阅读全文
posted @ 2018-09-29 20:31 静静地挖坑 阅读(125) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2018-09-29 20:07 静静地挖坑 阅读(139) 评论(0) 推荐(0)
摘要:Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once. Find all the elements of [1, n] 阅读全文
posted @ 2018-09-29 15:04 静静地挖坑 阅读(205) 评论(0) 推荐(0)
摘要:Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements. Example: 原题地址: M 阅读全文
posted @ 2018-09-29 14:26 静静地挖坑 阅读(106) 评论(0) 推荐(0)
摘要:Given a non-empty 2D array grid of 0's and 1's, an island is a group of 1's (representing land) connected 4-directionally (horizontal or vertical.) Yo 阅读全文
posted @ 2018-09-29 13:18 静静地挖坑 阅读(139) 评论(0) 推荐(0)
摘要:Given a binary array, find the maximum number of consecutive 1s in this array. Example 1: 原题地址: Max Consecutive Ones 难度: Easy 题意: 找出连续为1的子数组的最大长度 思路1: 阅读全文
posted @ 2018-09-29 12:18 静静地挖坑 阅读(336) 评论(0) 推荐(0)
摘要:Alice and Bob have candy bars of different sizes: A[i] is the size of the i-th bar of candy that Alice has, and B[j] is the size of the j-th bar of ca 阅读全文
posted @ 2018-09-29 11:23 静静地挖坑 阅读(141) 评论(0) 推荐(0)
摘要: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]. A 阅读全文
posted @ 2018-09-28 20:28 静静地挖坑 阅读(202) 评论(0) 推荐(0)
摘要:代码: 报错: 数组: 为什么? 等式右边 t[t[5]-1] 相当于 t[0] ,是对值-10的引用.首先是将t[5]的引用指向-10,此时 t[5] 的值变为-10,左边 t[t[5]-1] 相当于变成 t[-11] 阅读全文
posted @ 2018-09-26 11:15 静静地挖坑 阅读(471) 评论(0) 推荐(0)
摘要:由于版本问题,React中history不可用 首先应该导入react-router-dom包: 以前的写法: 这种方式会报错: 可以用 history包 (需要安装 npm install --save history )进行修改: 参考:https://stackoverflow.com/que 阅读全文
posted @ 2018-09-12 09:58 静静地挖坑 阅读(4130) 评论(0) 推荐(0)
摘要:某图书馆收藏有书籍具有不同的出版年份,管理员需要做一下统计工作: (1)每一年书籍的数目,如: 2000年有10本书, 2001年有5本书... (2)每一种书籍的数目,如: 西游记有10本, 三国演义有5本... (3)每一种书不同年份对应的数目, 如2本西游记在2000出版的,8本在2008年出 阅读全文
posted @ 2018-09-11 19:34 静静地挖坑 阅读(3179) 评论(0) 推荐(0)
摘要:数据表xiami_1,结构如下: 解释一下表数据: id: 序号 singer: 歌手名 title:歌曲名称 song_url: 歌曲链接 hot:歌曲听过的次数 area:歌手所属地区 数据量:390万 总时间 (查询次数*每一次查询时间) insert into xiami_1(singer, 阅读全文
posted @ 2018-09-11 17:13 静静地挖坑 阅读(224) 评论(0) 推荐(0)
摘要:涉及的关键字: where order by limit select from having like 1. from后面跟随table,最先访问 ==> 找到表 2.先选择字段还是操作记录,如果先选择字段,就无法操作记录,选择应从大范围查询到小范围,所以先进行记录处理. 那先进行排序还是limi 阅读全文
posted @ 2018-09-11 13:27 静静地挖坑 阅读(223) 评论(0) 推荐(0)
摘要:1.普通索引 2.唯一性索引 3.主键 创建索引 查看索引 阅读全文
posted @ 2018-09-11 12:43 静静地挖坑 阅读(103) 评论(0) 推荐(0)
摘要:明明数据库里的编码方式和字符集都没有问题,用python插入数据时,数据库里的数据还是乱码的 在数据库中插入时,能够正常显示 那就是python导出的数据存在编码问题,代码如下: 网上搜索了一下,添加两个参数use_unicode, charsetjike,修改后代码如下: 数据库输入就显示正常了 阅读全文
posted @ 2018-09-11 10:51 静静地挖坑 阅读(4385) 评论(0) 推荐(0)
摘要:现有数据表xiami,建表的时候忘记添加自增字段,现需要添加自增字段 第一步:添加字段 第二步:修改字段 问题: 表中记录数量为3929966条 查看创建表命令时,auto_increment为3932618 为什么auto_increment与记录数不一致? 在尝试插入记录至表中时,遇到字段长度不 阅读全文
posted @ 2018-09-11 09:42 静静地挖坑 阅读(8204) 评论(0) 推荐(0)
摘要:on delete 两张表之间产生联系,就必须存在交集 假设有A表和B表,A表存储学生信息,B表存储学生成绩 (1)删除A表的一条信息,B表没有影响 (2)删除A表的一条信息,B表中所有关于A表中的信息删除 (3)删除A表的一条信息,B表中的关于A表的记录设置成一个值 阅读全文
posted @ 2018-09-10 18:09 静静地挖坑 阅读(150) 评论(0) 推荐(0)
摘要:问题1: No migrations to apply 删除了migrations中0001_initial.py文件,重新执行 无法生成新的表 参考: http://www.cnblogs.com/mensiler/p/9455387.html 关键在于django的数据库中保存了表的信息,删除m 阅读全文
posted @ 2018-09-05 09:35 静静地挖坑 阅读(278) 评论(0) 推荐(0)