LeetCode Single Number I / II / III

[1]LeetCode 136 Single Number 题意:奇数个数,其中除了一个数只出现一次外,其他数都是成对出现,比如1,2,2,3,3...,求出该单个数. 解法:容易想到异或的性质,两个相同的数异或为0,那么把这串数从头到尾异或起来,最后的数就是要求的那个数. 代码如下: class Solution { public: int singleNumber(vector<int>& nums) { int sum = 0; for(int i=0;i<nums.siz

[译+改]最长回文子串(Longest Palindromic Substring) Part II

[译+改]最长回文子串(Longest Palindromic Substring) Part II 原文链接在http://leetcode.com/2011/11/longest-palindromic-substring-part-ii.html 原文作者有些地方逻辑上有点小问题,我做了纠正.关于解释时间复杂度上,原作者就只有两句话,我无法理解,特意在此加强了,便于理解. 问题:给定字符串S,求S中的最长回文子串. 在上一篇,我们给出了4种算法,其中包括一个O(N2)时间O(1)空间的算法

微软职位内部推荐-Software Development Engineering II

微软近期Open的职位: Job Title: Software Development Engineering II Work Location: Suzhou, China Enterprise customer and consumers are rapidly adopting Office 365 Cloud services. Delivering on those online services requires building, maintaining, and securin

LeetCode:Unique Binary Search Trees I II

LeetCode:Unique Binary Search Trees Given n, how many structurally unique BST's (binary search trees) that store values 1...n? For example, Given n = 3, there are a total of 5 unique BST's. 1 3 3 2 1 \ / / / \ \ 3 2 1 1 3 2 / / \ \ 2 1 2 3 分析:依次把每个节点

NOJ——1627Alex’s Game(II)(尺取)

[1627] Alex's Game(II) 时间限制: 2000 ms 内存限制: 65535 K 问题描述 Alex likes to play with one and zero as you know . Today he gets a sequence which contains n(n<=1e5) integers.Each integer is no nore than 100.now he wants to know what's the minimun contigous s

lintcode 最长上升连续子序列 II(二维最长上升连续序列)

题目链接:http://www.lintcode.com/zh-cn/problem/longest-increasing-continuous-subsequence-ii/ 最长上升连续子序列 II 给定一个整数矩阵(其中,有 n 行, m 列),请找出矩阵中的最长上升连续子序列.(最长上升连续子序列可从任意行或任意列开始,向上/下/左/右任意方向移动). 样例 给定一个矩阵 [ [1 ,2 ,3 ,4 ,5], [16,17,24,23,6], [15,18,25,22,7], [14,1

uCOS II在C8051F120上的移植

由于计算机技术的进步,单片机系统硬件规模越来越大,功能也越来越强,从而给运行嵌入式操作系统提供了硬件支持.为了更好地管理系统软硬件资源,嵌入式实时操作系统逐渐应用到嵌入式硬件平台. 1 嵌入式实时操作系统(RTOS) 嵌入式实时操作系统是嵌入式系统极为重要的组成部分,是能对整个系统及其操作部件装置等资源进行统一协调.指挥和控制的系统软件.RTOS具有通用操作系统的基本特点,如能够有效管理越来越复杂的系统资源:能够把硬件虚拟化,使得开发人员从繁忙的驱动程序移植和维护中解脱出来:能够提供库函数.驱动

LeetCode - N-Queens II

N-Queens II 2014.2.13 20:01 Follow up for N-Queens problem. Now, instead outputting board configurations, return the total number of distinct solutions. Solution: This problem is a simplification from the N-Queens. This time we only have record the n

LeetCode - Unique Binary Search Trees II

Unique Binary Search Trees II 2014.2.10 02:54 Given n, generate all structurally unique BST's (binary search trees) that store values 1...n. For example, Given n = 3, your program should return all 5 unique BST's shown below. 1 3 3 2 1 \ / / / \ \ 3

LeetCode - 40. Combination Sum II

40. Combination Sum II Problem's Link ---------------------------------------------------------------------------- Mean: 给你一个待选集合s和一个数n,选出所有相加之和为n的组合.(每个元素只能选一次) analyse: 递归求解. 在递归进入下一层时加判断,相邻两个相等则跳过一次,否则如果当前值对应后面组合有答案,将会算进去两次. Time complexity: O(N)

Light OJ 1232 Coin Change (II)

1232 - Coin Change (II) PDF (English) Statistics Forum Time Limit: 1 second(s) Memory Limit: 32 MB In a strange shop there are n types of coins of value A1, A2 ... An. You have to find the number of ways you can make K using the coins. You can use an

Pascal&#39;s Triangle I, II

题目链接 https://leetcode.com/problems/pascals-triangle/ https://leetcode.com/problems/pascals-triangle-ii/ 这两道题都是数组操作,需要注意的是II在I的基础上使用滚动数组存储过往的中间结果,这个思想可以注意一下,一些DP的题目也会用到 I's code class Solution { public: vector<vector<int> > generate(int numRows

Selection II

[Selection II] 1.上.下.左.右键可以移动Selection 1个像素.按住Shift键,可以一次移动10个像素. 2.Add Selection模式的快捷键是Shift,Sub Selection模式的快捷键是Option.同时按住Shift.Option,进行与运算. 3.菜单:elect > Modify > Expand or Contract.可以对已有Selection进行绽放,控制参数是像素. 4.菜单:Select > Modify > Border

UESTC_方老师的分身 II CDOJ 915

方老师的分身 II Time Limit: 10000/5000MS (Java/Others) Memory Limit: 65535/65535KB (Java/Others) Submit Status 方老师计算出了走路时间最长的那个分身所用的时间.于是有个特殊的分身(据说是方老师真身!)就不想如此古板的走最短路了!由于这个分身的特殊性,这个分身对于单向边可以当双向边走.但是这个特殊的分身想走最短路的同时,要求至少经过k条边. Input 有多组数据 第一行两个整数n,m(1≤n≤500

LeetCode: Search in Rotated Sorted Array II 解题报告

Search in Rotated Sorted Array II Follow up for "LeetCode: Search in Rotated Sorted Array 解题报告": What if duplicates are allowed? Would this affect the run-time complexity? How and why? Write a function to determine if a given target is in the ar

GTK+中的构件II(Widgets)

GTK+中的构件II(Widgets) GTK+中的构件II(Widgets) 在本章的GTK+程序设计中,我们仍然要继续向大家介绍和展示各种各样的构件. GtkComboBox GtkComboBox构件的作用是让程序使用者根据不同的需求从很多选项中进行选择. #include <gtk/gtk.h> void combo_selected(GtkWidget *widget, gpointer window) { gchar *text = gtk_combo_box_get_active