Web appOpen in Telegram

PostThis one took me much longer time not gonna lie.๐Ÿ˜ฎโ€๐Ÿ’จ

18 December 2024
<
< Ace Coding /> ๐Ÿš€
Reply/* You are given a string s consisting only of lowercase English letters. We call a substring special if it contains no character which has occurred at least twice (in other words, it does not contain a repeating character). Your task is to count the number of special substrings. For example, in t
This one took me much longer time not gonna lie.๐Ÿ˜ฎโ€๐Ÿ’จ โœ… Solution : this is as efficient as it can get python def countSpaceialSubString(s): seen = set() l = 0 count = 0 for r in range(len(s)): if s[r] in seen: while s[l] != s[r]: seen.remove(s[l]) l += 1 l += 1 seen.add(s[r]) count += r - l + 1 return count print(countSpaceialSubString("abcd")) print(countSpaceialSubString("ooo")) print(countSpaceialSubString("abab")) print(countSpaceialSubString("abcabc"))
3 ยท 409 ยท

Nearby in the feed

<< Ace Coding /> ๐Ÿš€โœ… Free leetcode questions which is 99% similar with the first question : class Solution: def countSubstrings(self, s: str, c: str) -> int: count = s.count(c) re<< Ace Coding /> ๐Ÿš€/* You are given a string s consisting only of lowercase English letters. We call a substring special if it contains no character which has occurred at least tw
this message
<< Ace Coding /> ๐Ÿš€Photo<< Ace Coding /> ๐Ÿš€Question: Can You Make This String a Palindrome? A palindrome is a string that reads the same forwards and backwards. Given a string, determine if it's possible
<< Ace Coding /> ๐Ÿš€< Ace Coding /> ๐Ÿš€@AceCoding ยท channel ยท Tech
334subscribers345posts in the index
Venue feed Open in Telegram

An open public feed from the search index ChatCrawler โ€” โ€œGoogle for public Telegramโ€; refreshed as the venue is crawled. Times are UTC.

Public content only, official Telegram API. About ยท FAQ ยท What we do not do ยท Remove a page ยท Catalog ยท Search ยท How we count