Number Maping

Javascript code posted by Drsko Senchitj
created at 13 Nov 14:53

Edit | Back
1
2
3
4
5
6
7
function mapNumber(id1, id2){

        var firstDigit = Math.min(id1, id2);
        var secondDigit = Math.max(id1, id2);

        return (firstDigit*(25-firstDigit)>>1) + secondDigit - 1;
}
196 Bytes in 2 ms with coderay