@@ -0,0 +1,1529 @@
+package com.freetymekiyan.algorithms.other;%0A%0Aimport org.junit.After;%0Aimport org.junit.Assert;%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0A%0A/**%0A * Given a list of integers and a mapping between integers and letters, 1 to A, 2 to B ... 26 to Z.%0A * Generate all possible combinations of letters from the intergers.%0A * %3Cp%3E%0A * Tags: Backtracking%0A */%0Apublic class IntegerToLetters %7B%0A%0A    private IntegerToLetters itl;%0A%0A    public List%3CString%3E toLetters(String nums) %7B%0A        List%3CString%3E res = new ArrayList%3C%3E();%0A        helper(nums, %22%22, 0, res);%0A        return res;%0A    %7D%0A%0A    private void helper(String nums, String s, int start, List%3CString%3E res) %7B%0A        if (start %3E= nums.length()) %7B%0A            res.add(s);%0A            return;%0A        %7D%0A        for (int end = start + 1; end %3C= nums.length() && end %3C= start + 2; end++) %7B%0A            int temp = Integer.parseInt(nums.substring(start, end));%0A            if (1 %3C= temp && temp %3C= 26) %7B%0A                s += ((char) (temp + 'A' - 1));%0A                helper(nums, s, end, res);%0A                s = s.substring(0, s.length() - 1);%0A            %7D%0A        %7D%0A    %7D%0A%0A    @Before%0A    public void setUp() %7B%0A        itl = new IntegerToLetters();%0A    %7D%0A%0A    @Test%0A    public void testExamples() %7B%0A        List%3CString%3E res = itl.toLetters(%22123%22);%0A        Assert.assertNotNull(res);%0A        Assert.assertEquals(3, res.size());%0A        System.out.println(res);%0A    %7D%0A%0A    @After%0A    public void tearDown() %7B%0A        itl = null;%0A    %7D%0A%0A%7D%0A

add Integer to Letters