摘要:
//N皇后的基础上改了一点class Solution { public: int totalNQueens(int n) { int res = 0; vector pos(n,-1); DFS(pos,0,res); return res; } void DFS(vector& pos,int row,i... 阅读全文
摘要:
//看了一次解析后,一次AC,用一个pos记录行列。class Solution { public: vector> solveNQueens(int n) { vector> res; vector pos(n,-1); DFS(pos,0,res); return res; } void DF... 阅读全文
摘要:
//经典class Solution { public: int maxSubArray(vector& nums) { int sum = 0; int maxsum = -INT_MAX; for(int i=0;i maxsum) maxsum = sum; if(sum < 0) sum = 0; ... 阅读全文
摘要:
//1开始我只是按照原来快速幂的思想,当n 0?res:1/res; } }; 阅读全文