原创 Leetcode Sum of Two Intergers

Calculate the sum of two integers a and b, but you are not allowed to use the operator + and -. Example: Given a = 1

原创 python 列表推導 求100內的素數

列表推導式(list comprehension)是利用其他列表創建新列表(類似於數學術語中的集合推導式)的一種方法。它的工作方式類似於for循環,也很簡單: In [39]: [x*x for x in range(10)]Out[

原创 python zip map

1.zip平行遍歷操作 1 >>> name=('jack','beginman','sony','pcky') 2 >>> age=(2001,2003,2005,2000) 3 >>> for a,n in zip(name,ag

原创 STM32+ucos+ucgui+fatfs+bmp解碼+JPG解碼

1.整個project由一個基本菜單組成,可以讀出SD卡里面的文檔。可以顯示320*240以內的任意圖片(BMP,JGP)。是自動解碼的哈~ 2.本來想附上兩張圖,無奈手機像素太低。效果很不好,就免去了。整個project是基於奮鬥V3板

原创 歐幾里得求最大公約數/python

這個個求最大公約數的函數,利用了歐幾里得算法。 歐幾里得法求最大公約數:求a和b的最大公約數記 a mod b=c ,即a=kb+c 設a b的最大公約數爲d,則a=m*d b=n*d,m和n互質。c=a-kb=md-knd=(m-kn

原创 兩個大數相乘

# include<stdio.h> # include<string.h> # include<malloc.h>   void multiply

原创 python 切片,字符串逆序神器

字符串、列表、元組在python中都符合“序列”這一特徵,只要符合這一特徵的變量我們都可以用切片(slice)去存取它們的任意部分。我們可以把序列想像成一個隊列,我可能需要前面三位、後面三位、或從第三位後的四位、或隔一個取一個等,我們

原创 python 字典/集合操作

字典的基本操作 1、如何訪問字典中的值? adict[key] 形式返回鍵key對應的值value,如果key不在字典中會引發一個KeyError。 2、如何檢查key是否在字典中? a、has_key()方法 形如:adict

原创 快速排序 兩種方法

1.分治思想。 Partition 函數將數組最後一個元素作爲Key. 所有比Key小的數放到Key的左邊,所有比Key大的數放到Key的右邊。 實現後 list[0,1,.....key-1....]範圍的數都比key小 list[k

原创 車牌識別系統 opencv

這個車牌識別系統(opencv定位,切割+BP神經網絡識別字符)我已經在本科畢業的時候順利完成了,相關的文檔可以給大家一個鏈接~祝順。http://wenku.baidu.com/view/0d69765dbed5b9f3f90f1cd5

原创 leetcode Valid Anagram

Given two strings s and t, write a function to determine if t is an anagram of s. For example,s = "anagram", t = "nag

原创 leetcode Revert Binary Tree

homebrew的作者面試google,面試官要求他手寫一個反轉一個二叉樹的功能。最後卻沒寫出來,於是有了下面的新聞: Google: 90% of our engineers use the software you wrote (

原创 leetcode Majority Element

Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2

原创 vbox 命令行操作

老大讓搭個服務器,做IoT端的接受服務器。我選了KAA,官網提供vbox的沙盒鏡像,直接裝即可。 服務器上裝的是centos,我就想直接在centos上裝virtuanl box ,然後導入沙盒。奈何服務器是個workstation,木有

原创 leetcode Same Tree

Given two binary trees, write a function to check if they are equal or not. Two binary trees are considered equal if