摘要:
The set [1,2,3,…,n] contains a total of n! unique permutations. By listing and labeling all of the permutations in order,We get the following sequence 阅读全文
摘要:
Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the string. If the last word 阅读全文
摘要:
1. Merge Given a collection of intervals, merge all overlapping intervals. For example,Given [1,3],[2,6],[8,10],[15,18],return [1,6],[8,10],[15,18]. / 阅读全文
摘要:
sort中的比较函数compare要声明为静态成员函数或全局函数,不能作为普通成员函数,否则会报错: invalid use of non-static member function 因为:非静态成员函数是依赖于具体对象的,而std::sort这类函数是全局的,因此无法在sort中调用非静态成员函 阅读全文
摘要:
1. Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order. For example,Given the following matrix: [ 阅读全文
摘要:
1. 求所有解 The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other. Given an integer n, ret 阅读全文
摘要:
Implement pow(x, n). double myPow(double x, int n) { unsigned int m = n; bool flag = false; double ans = 1; if(n < 0) { flag = true; m = -n; } while(m 阅读全文
摘要:
map.find(keyword) == map.end() 阅读全文
摘要:
You are given an n x n 2D matrix representing an image. Rotate the image by 90 degrees (clockwise). Follow up:Could you do this in-place? void rotate( 阅读全文
摘要:
求全排列。 1. 无重复元素 Given a collection of distinct numbers, return all possible permutations. For example,[1,2,3] have the following permutations:[1,2,3], 阅读全文