Codelet Keep code simple stupid

Letter Combinations of a Phone Number

Question Given a digit string, return all possible letter combinations that the number could represent. A mapping of digit to letters (just like on the telephone buttons) is given below. Input:Digit string "23" Output: ["ad", "ae", "af", "bd", "be", "bf", "cd", "ce", "cf"]. ...

3Sum Closest

Question Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that each input would have exactly one solution. For example, given array S = {-1 2 1 -4}, and target = 1. Th...

3Sum

Question Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero. Note: The solution set must not contain duplicate triplets. For example, given array S = [-1, 0, 1, 2, -1, -4], ...

Longest Common Prefix

Question Write a function to find the longest common prefix string amongst an array of strings. Solution #include <vector> #include <string> using namespace std; class Solution { public: string longestCommonPrefix(vector<string>& strs) { if (strs.size() == 0)...

面向切面编程

面向切面编程(aspect-oriented programming,AOP)也叫面向方面编程,面向侧面编程,剖面导向编程, 是一种常用的程序开发范式,在工程上有很多的应用场景,比如:日志(logging)、用户权限检查以及表单 数据验证等,都可以使用AOP的方式来优化程序的结构。 先看面向切面编程的定义: In computing, aspect-oriented programming (AOP) is a programming paradigm that aims to increase modularity by allowing the separation of ...