Skip to content

Bug Report for string-encode-and-decode #4882

@shahidbits-cs

Description

@shahidbits-cs

Bug Report for https://neetcode.io/problems/string-encode-and-decode

Please describe the bug below and include any steps to reproduce the bug or screenshots if possible.

I am not seeing the expected logs in stdout for the ones added if block and/or after if block in decode method. At least, one of the logs must be printed.

public List<String> decode(String str) {

        System.out.println(str + " ** "); // <<--- printed

        String[] tokens = str.split(sizeDelim);
        System.out.println(str + " ^^ "); // <<--- printed
        
        if ("0".equals(tokens[0])) {
            System.out.println("1=" + str + " -- "); // <<--- not printed
            System.out.println("-- tokens[0]=" + tokens[0]); // <<--- not printed
            return Collections.EMPTY_LIST;
        }
        if (tokens[1] == null || tokens[1].equals("")) {
            System.out.println("2=" + str + " == "); // <<--- not printed
            System.out.println("tokens[1]=" + tokens[1]); // <<--- not printed
            return List.of("");
        }

        System.out.println("3=" + str + " __ "); // <<--- not printed
        System.out.println("-- tokens[1]=" + tokens[1]); // <<--- not printed
        return Arrays.asList(tokens[1].split(delim));
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions