问题:输出二叉树的每一行的结点,从叶子到根/** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(i...
分类:
其他好文 时间:
2014-08-06 22:04:02
阅读次数:
185
问题:输出杨辉三角的第n行class Solution {public: vector getRow(int rowIndex) { vector vec; int a[100][100]; a[0][0]=1; int j,i; ...
分类:
其他好文 时间:
2014-08-06 22:03:42
阅读次数:
214
问题:消除数组中重复次数超过三次的多余的数分析:若ai-1==ai-2若ai也相等,则清楚aiclass Solution {public: int removeDuplicates(int A[], int n) { int i,j; for(i=2;i<n;i+...
分类:
其他好文 时间:
2014-08-06 21:41:52
阅读次数:
199
对于n个数,可以做k次移动,每次移动可以互换相邻位置的两个数,问最少 number of pair (i,j) where 1≤ii>aj.
如果不移动的话,ans=’n个数的逆序对数‘,移动k次会减少k个
归并排序求逆序对数:
#include "stdio.h"
#include "string.h"
#include "math.h"
int b[100010],a[1...
分类:
其他好文 时间:
2014-08-06 14:53:51
阅读次数:
211
题目:Given two words (start and end), and a dictionary, find all shortest transformation sequence(s) from start to end, such that:Only one letter can b....
分类:
编程语言 时间:
2014-08-06 01:52:30
阅读次数:
251
步骤1新建或打开Quartus II工程,用QII自带文本编辑器打开HDL文件。图1 用QII自带的文本编辑器打开HDL文件步骤2选择File>Create / Update>Creat Symbol Files for Current File,等待图3所示画面出现即可。图2 选择Creat Sy...
分类:
其他好文 时间:
2014-08-05 18:32:19
阅读次数:
344
Quartus II综合器对于使能信号的产生 对比下面的代码和综合结果(代码取自crazybingo例程):always@(posedge clk or negedge rst_n)begin if(!rst_n) delay_cnt <= 0; else if(de...
分类:
其他好文 时间:
2014-08-05 18:11:29
阅读次数:
210
Follow up for "Unique Paths":Now consider if some obstacles are added to the grids. How many unique paths would there be?An obstacle and empty space i...
分类:
其他好文 时间:
2014-08-05 18:09:19
阅读次数:
168
题目:Given a string s, partition s such that every substring of the partition is a palindrome.Return the minimum cuts needed for a palindrome partition....
分类:
编程语言 时间:
2014-08-05 13:32:29
阅读次数:
252
题目:Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root).F....
分类:
编程语言 时间:
2014-08-05 05:18:08
阅读次数:
340