LeetCode153. Find Minimum in Rotated Sorted Array

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). Find the min...

LeetCode724. Find Pivot Index

Given an array of integers nums, write a method that returns the “pivot” index of this array. We define the pivot index as the index where the sum of the num...

LeetCode728. Self Dividing Numbers

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 == ...

数据库存储系统漫谈

从大作业说起上大学的时候,相信很多学软件工程的同学常会有个大作业要求做一个图书管理系统或人事管理系统,本质上就是设计一个数据库存储系统。我们以图书管理系统为例,假设需要存储的字段有id,name(书名),author(作者),查询的需求为根据id去获取图书的信息。 最简单的做法,以id为key,剩下的作为valu...

如何追查诡异问题

概述这里的“问题“,主要指一个软件系统中,由于硬件故障、程序bug或人为失误而导致的系统异常。“诡异问题”指的是不是那么容易追查的问题,有些问题一看就知道原因,这种问题不在本文讨论之内。解决诡异问题一般会有四个步骤: 分析问题 复现问题 定位问题原因 寻找解决方案 一、分析问题信息收集一般来说拿到一个问题,先...

LeetCode28. Implement strStr()

Implement strStr(). Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack. 简单的做法双重循环,依次去比较,时间复杂度O(m*n) 123...

LeetCode24. Swap Nodes in Pairs

Given a linked list, swap every two adjacent nodes and return its head. For example,Given 1->2->3->4, you should return the list as 2->1->4-&g...

LeetCode70. Climbing Stairs

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 ...

LeetCode67. Add Binary

Given two binary strings, return their sum (also a binary string). For example,a = "11"b = "1"Return "100". 1234567891011121314...

LeetCode39. Combination Sum

Given a set of candidate numbers (C) (without duplicates) and a target number (T), find all unique combinations in C where the candidate numbers sums to T. T...