---
# System prepended metadata

title: '20200303'

---

# 20200303

Message A-Z

A - 1
B - 2
C - 3
.
.
.
Z - 26

"123" -> 3 [A, B, C], [L, C], [A, W]

"103" -> 1 [J, C]

"023" -> 1 [W]

dp = [0, 0, 0, 0]
dp = [1, 1, 2, 3]

dp = [0, 0, 0, 0]
dp = [1, 1, 1, 1]

"12345"
[0,0,0,0,0,0]
[1,1,2,3,3,3]
"12312"
[0, 0, 0, 0, 0, 0]
[1, 1, 2, 3, 3, 6]
123 -> 1, 12 
1231 -> 12, 123 

12,
23,
31,

```
dp[0] = 1
dp[1] = s.charAt(0) != '0' ? 1 : 0;
// 103
for(int i = 2; i <= length; i++) {
    int first = Integer.valueOf(s.substring(i-1, i));
    int second = Integer.valueOf(s.substring(i-2, i));
    if (first > 0 && first <= 9) {
        dp[i] += dp[i-1];
    }
    if (second >= 10 && second <= 26) {
        dp[i] += dp[i-2];
    }
}
```


arr = [-1, 0, 1, 2, -1, -4]
output = [-1, 0, 1], [-1, -1, 2]

arr = [-4, -1, -1, 0, 1, 2]
        a       s        f
```
public List<List<Integer>> threeSum(int[] nums) {
    Arrays.sort(nums);
    List<List<Integer>> result = new ArrayList()
    for (int i = 0; i < nums.length - 2; i++) {
        int slow = i + 1;
        int fast = i + 2;
        while(fast < nums.length) {
            if (nums[i] + nums[slow] + nums[fast] == 0) {
                List<Integer> ans = new ArrayList();
                ans.add(nums[i]);
                ans.add(nums[i+1]);
                ans.add(nums[i+2]);
            } 
            if (fast == nums.length - 1) {
                slow++;
                fast = slow + 1;
            }
            fast++;
           
        }
    }
    return result;
}
```
