So, I'm trying to do something like this: (example)
a, b , C, D .. etc AA, AB, AC .. etc BA, BB, BC, etc.
So, it is basically growing and simply sorting all possible differences, starting from one to the other, I am able to do it with a letter, it starts like this. :
for (int i = 97; i & lt; = 122; i ++) {item = (char) I} but , I'm unable to finally add the second letter, the third letter, and so on. Anybody able to provide input? Thank you.
Since there is not a solution yet, which is actually going to "increase the string" here is one that: (string) (new string ('a', S.Length + 1) ; } Var res = s.ToCharArray (); Var pos = res.Length - 1; Do {if (res [pos]! = 'Z') {res [pos] ++; break; } Res [pos--] = 'a'; } While (true); Return new string (leakage); } This idea is simple: show that the letters are your numbers, and the way they read in an elementary school, increase wages. Start with the right "digit", and increase it. If you hit nine (which is 'z' in our system), then go to the first digit; Otherwise, you are raising the salary. The obvious case is when a "number" is made up of nine entirely, it happens when your "counter" needs to be rolled into the next shape, and add "points" This special situation is checked at the beginning of the method: If the string is made of a string of N letters 'z' , N + 1 'a' s has been returned. Here's one.
Comments
Post a Comment