File tree 1 file changed +0
-35
lines changed
src/main/java/com/fishercoder/solutions
1 file changed +0
-35
lines changed Original file line number Diff line number Diff line change 1
1
package com .fishercoder .solutions ;
2
2
3
- /**
4
- * 880. Decoded String at Index
5
- *
6
- * An encoded string S is given. To find and write the decoded string to a tape,
7
- * the encoded string is read one character at a time and the following steps are taken:
8
- * If the character read is a letter, that letter is written onto the tape.
9
- * If the character read is a digit (say d), the entire current tape is repeatedly written d-1 more times in total.
10
- * Now for some encoded string S, and an index K, find and return the K-th letter (1 indexed) in the decoded string.
11
- *
12
- * Example 1:
13
- * Input: S = "leet2code3", K = 10
14
- * Output: "o"
15
- * Explanation:
16
- * The decoded string is "leetleetcodeleetleetcodeleetleetcode".
17
- * The 10th letter in the string is "o".
18
- *
19
- * Example 2:
20
- * Input: S = "ha22", K = 5
21
- * Output: "h"
22
- * Explanation:
23
- * The decoded string is "hahahaha". The 5th letter is "h".
24
- *
25
- * Example 3:
26
- * Input: S = "a2345678999999999999999", K = 1
27
- * Output: "a"
28
- * Explanation:
29
- * The decoded string is "a" repeated 8301530446056247680 times. The 1st letter is "a".
30
- *
31
- * Note:
32
- * 2 <= S.length <= 100
33
- * S will only contain lowercase letters and digits 2 through 9.
34
- * S starts with a letter.
35
- * 1 <= K <= 10^9
36
- * The decoded string is guaranteed to have less than 2^63 letters.
37
- * */
38
3
public class _880 {
39
4
public static class Solution1 {
40
5
public String decodeAtIndex (String S , int K ) {
You can’t perform that action at this time.
0 commit comments