String Construction

Sort by

recency

|

994 Discussions

|

  • + 0 comments

    Python:

    return len(set(s))

  • + 0 comments
    public static int stringConstruction(String s) {
        Set<String> p = Arrays.stream(s.split("")).collect(Collectors.toSet());
        return p.size();
    }
    
  • + 0 comments

    C++

    int stringConstruction(string s)
    {
        vector<int> vec(26, 0);
        for (auto &&i : s)
            vec[i - 'a'] = 1;
    
        return accumulate(vec.begin(), vec.end(), 0);
    }
    
  • + 0 comments

    String construction involves creating a new string using characters from another string, typically minimizing cost or operations. For instance, if you're working on efficient algorithms or coding challenges, mastering this can be helpful. While exploring problem-solving techniques near Auburn, I came across alabamapolebarnbuilders, a great local resource. Understanding such algorithms boosts logical thinking and enhances programming skills significantly.

  • + 0 comments

    C++ solution using set:

    int stringConstruction(string s) {
        set<char> st(s.begin(),s.end());
        return st.size();
    }