01 2018 档案
摘要: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 m
阅读全文
摘要:内连接(INNER JOIN): 分为三种 等值连接、自然连接、不等连接 外连接(OUTER JOIN): 左外连接(LEFT OUTER JOIN或LEFT JOIN) 右外连接(RIGHT OUTER JOIN或RIGHT JOIN) 全外连接(FULL OUTER JOIN或FULL JOIN
阅读全文
摘要: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
阅读全文
摘要:Write a SQL query to delete all duplicate email entries in a table named Person, keeping only unique emails based on its smallest Id. For example, aft
阅读全文
摘要:Given a Weather table, write a SQL query to find all dates' Ids with higher temperature compared to its previous (yesterday's) dates. For example, ret
阅读全文
摘要:Given a table salary, such as the one below, that has m=male and f=female values. Swap all f and m values (i.e., change all f values to m and vice ver
阅读全文
摘要:Write a SQL query to get the second highest salary from the Employee table. For example, given the above Employee table, the query should return 200 a
阅读全文
摘要:There is a table courses with columns: student and class Please list out all classes which have more than or equal to 5 students. For example, the tab
阅读全文
摘要:Suppose that a website contains two tables, the Customers table and the Orders table. Write a SQL query to find all customers who never order anything
阅读全文
摘要:The Employee table holds all employees including their managers. Every employee has an Id, and there is also a column for the manager Id. Given the Em
阅读全文
摘要:Write a SQL query to find all duplicate emails in a table named Person. For example, your query should return the following for the above table: Note:
阅读全文
摘要:Table: Person Table: Address Write a SQL query for a report that provides the following information for each person in the Person table, regardless if
阅读全文
摘要:X city opened a new cinema, many people would like to go to this cinema. The cinema also gives out a poster indicating the movies’ ratings and descrip
阅读全文
摘要:There is a table World A country is big if it has an area of bigger than 3 million square km or a population of more than 25 million. Write a SQL solu
阅读全文
摘要:You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your product fails the quality c
阅读全文
摘要:概述: 索引(Index)是帮助MySQL高效获取数据的数据结构。 索引是以表列为基础的数据库对象,它保存着表中排序的索引列,并且记录了索引列在数据表中的物理存储位置,实现了表中数据的逻辑排序, 其主要目的是提高数据库系统的性能,加快数据的查询速度和减少系统的响应时间。 在MySQL中,索引是在存储
阅读全文
摘要:Given a 32-bit signed integer, reverse digits of an integer. Example 1: Example 2: Example 3: Note:Assume we are dealing with an environment which cou
阅读全文
摘要:直接插入排序: 将一个记录插入到已排序好的有序表中,从而得到一个新,记录数增1的有序表。即:先将序列的第1个记录看成是一个有序的子序列,然后从第2个记录逐个进行插入,直至整个序列有序为止。 时间复杂度:O(n^2) 稳定的 希尔排序: 先将要排序的一组记录按某个增量d(n/2,n为要排序数的个数)分
阅读全文
摘要:Implement the following operations of a stack using queues. push(x) -- Push element x onto stack. pop() -- Removes the element on top of the stack. to
阅读全文
摘要:Given a linked list, determine if it has a cycle in it. Follow up:Can you solve it without using extra space? 判断一个链表是否有环 C++(10ms):
阅读全文
摘要:We are playing the Guess Game. The game is as follows: I pick a number from 1 to n. You have to guess which number I picked. Every time you guess wron
阅读全文
摘要:Given an integer, write an algorithm to convert it to hexadecimal. For negative integer, two’s complement method is used. Note: Example 1: Example 2:
阅读全文
摘要:mv命令用来对文件或目录重新命名,或者将文件从一个目录移到另一个目录中。source表示源文件或目录,target表示目标文件或目录。如果将一个文件移到一个已经存在的目标文件中,则目标文件的内容将被覆盖。 mv命令可以用来将源文件移至一个目标文件中,或将一组文件移至一个目标目录中。源文件被移至目标文
阅读全文
摘要:rm命令可以删除一个目录中的一个或多个文件或目录,也可以将某个目录及其下属的所有文件及其子目录均删除掉。对于链接文件,只是删除整个链接文件,而原有文件保持不变。
阅读全文
摘要:Given two lists Aand B, and B is an anagram of A. B is an anagram of A means B is made by randomizing the order of the elements in A. We want to find
阅读全文
摘要:MySQL中的事务 数据库事务隔离级别 MySQL 的数据存储引擎 MySQL的索引 聚集索引和非聚集索引区别 MySQL索引失效 乐观锁和悲观锁 MySQL中的内连接、外连接、交叉连接 数据库设计三大范式 慢查询日志和profiling explain的使用
阅读全文
摘要:MySQL的存储引擎 InnoDB: MySQL5.5之后的默认存储引擎。 采用MVCC来支持高并发,并且实现了四个标准的隔离级别(默认可重复读)。 支持事务,支持外键、支持行锁、非锁定读(默认读取操作不会产生锁) 行锁优点是适用于高并发的频繁表修改,高并发是性能优于 MyISAM。缺点是系统消耗较
阅读全文
摘要:Remove all elements from a linked list of integers that have value val. ExampleGiven: 1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6, val = 6Return: 1 --> 2 --
阅读全文
摘要:数据库事务的隔离级别有4个,由低到高依次为Read uncommitted、Read committed、Repeatable read、Serializable 这四个级别可以逐个解决脏读、不可重复读、幻读这几类问题。 READ UNCOMMITTED (未提交读): 事务中的修改,即使没提交,对
阅读全文
摘要:Implement the following operations of a queue using stacks. push(x) -- Push element x to the back of queue. pop() -- Removes the element from in front
阅读全文
摘要:数据库事务 事务指的是满足 ACID 特性的一系列操作。在数据库中,可以通过 Commit 提交一个事务,也可以使用 Rollback 进行回滚。 在 MySQL 中只有使用了 Innodb 数据库引擎的数据库或表才支持事务。 MYSQL 事务处理主要有两种方法: 1、用 BEGIN, ROLLBA
阅读全文
摘要:You are given a license key represented as a string S which consists only alphanumeric character and dashes. The string is separated into N+1 groups b
阅读全文
摘要: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. Example:
阅读全文