摘要:
Given an arraySofnintegers, are there elementsa,b,c, anddinSsuch thata+b+c+d= target? Find all unique quadruplets in the array which gives the sum of ... 阅读全文
posted @ 2014-04-28 17:25
Agentgamer
阅读(231)
评论(0)
推荐(0)
摘要:
Implement pow(x,n).有史以来做过最简单的一题,大概用5分钟ac,我采用fast exponential,这个在sicp的第一章就有描述。思想是:如果n是偶数的话,那么m^n = (m^(n/2))^2, 如果n是奇数,那么m^n = m*m^(n-1)。这样一来是O(logn)的。... 阅读全文
posted @ 2014-04-28 16:59
Agentgamer
阅读(142)
评论(0)
推荐(0)

浙公网安备 33010602011771号