原创 calloc=malloc+memset?

功能上calloc=malloc+memset; 從彙編指令來看的話,calloc的指令是malloc+memset的一半左右。 時間上來說,cal

原创 leetcode 10 Regular Expression Matching & 44 Wildcard Matching

Regular Expression Matching Implement regular expression matching with support for '.' and '*'. '.' Matches any sing

原创 1.8 找到只含3,5,7因子的第k大的數

1.8 Design an algorithm to find the kth number such that the only prime factors are 3, 5, and 7. 能想到的就是暴力一下了。。。 貌似還有更好的

原创 linux下的依賴包

在某臺內網服務器上安裝Oprofile,但是提示確實liberty庫,安裝liberty庫,又提示缺少binutils,如此以往。。。 怎麼能一下找到所需要的所有依賴包呢? debian/ubuntu中查詢某軟件的依賴關係,或者該軟件

原创 1.7 用加法實現乘除減運算

1. 7 Write a method to implement *, - , / operations. You should use only the + operator. 直接貼答案吧。。 With an understandin

原创 1.5 計算階乘末尾0的個數

1.5 Write an algorithm which computes the number of trailing zeros in n fa

原创 leetcode 11 Container With Most Water

Container With Most Water Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinat

原创 leetcode 9 Palindrome Number

 Palindrome Number Determine whether an integer is a palindrome. Do this without extra space. click to show spoiler

原创 1.6 不用算術符號實現加法

1. 6 Write a function that adds two numbers. You should not use + or any arithmetic operators. 一看就是需要用邏輯運算實現加法。 邏輯運算有一些

原创 1.9 最高的 身高體重從上到下依此遞增的塔

1.9 A circus is designing a tower routine consisting of people standing at

原创 1.10 找經過點最多的直線

1.10 Given a two dimensional graph with 6000 points on it, find a line which passes the most number of points. 開始想要不要先

原创 leetcode 7 Reverse digits of an integer

Reverse digits of an integer. Example1: x = 123, return 321 Example2: x = -123, return -321 class Solution: #

原创 leetcode 4 Median of Two Sorted Arrays

Median of Two Sorted Arrays There are two sorted arrays A and B of size m and n respectively. Find the median of the t

原创 leetcode 1 Two Sum

Two Sum Given an array of integers, find two numbers such that they add up to a specific target number. The functio

原创 leetcode 3 Longest Substring Without Repeating Characters

Longest Substring Without Repeating Characters Given a string, find the length of the longest substring without repeat