Trivial 1 ms Java solution

  • -1
    public class Codec {
        private List<String> lastInput;
        // Encodes a list of strings to a single string.
        public String encode(List<String> strs) {
            lastInput = strs;
            return "";
        // Decodes a single string to a list of strings.
        public List<String> decode(String s) {
            return lastInput;

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.