< Ace Coding /> πŸš€
337 subscribers
54 photos
2 videos
95 files
66 links
Welcome to Ace Coding! Join us for tips, tutorials, and insights on coding and software engineering. Stay updated with the latest content and elevate your programming skills!Let's learn and grow together in the world of software engineering!
Download Telegram
Stacks, Queues and Monotonicity.pdf
1.5 MB
βœ… A2SV Community Education Resources.πŸ“—

🟒 Very good resources for A2SV interview prep.


πŸŒŸπŸš€ @AceCoding Presents! πŸš€πŸŒŸ
πŸ‘1
πŸ“’ Important Update for A2SV G6 In person Education Cohort!

If you've received an email from A2SV, congratulations! πŸŽ‰ You’ve been shortlisted for an interview for the A2SV G6 Cohort!

πŸ—“ Interviews Begin: on Tuesday
πŸ“Œ Focus Areas: Make sure to prepare thoroughly on the topics mentioned in the email.

If you haven’t checked your email yet, go check it now and start your preparation! πŸ“¨

πŸš€ @AceCoding Presents! πŸš€
🧠 Python Quiz: Predict the Output

arr = [[0]] * 5  
print(arr)
arr[0][0] = 1
print(arr)


What will the output be? You can choose your answer below.

@AceCoding Presents!
βœ… Explanation for the above question

©️ credit for ChatGPT 🀝
βœ… Sliding window, Two pointers, and Hash Table problem

🟑 567. Permutation in String

https://leetcode.com/problems/permutation-in-string/submissions/1482104785/

πŸš€ @AceCoding Presents! πŸš€
βœ… Dynamic Sliding window and hashmap / hashset problem.

This problem has a pattern that repeats a lot : worth revising

🟑 3. Longest Substring Without Repeating Characters

https://leetcode.com/problems/longest-substring-without-repeating-characters/description/

πŸš€ @AceCoding Presents! πŸš€
πŸ‘1
Substrings that begin and end with the same letter

You are given a 0-indexed string s consisting of only lowercase English letters. Return the number of substrings in s that begin and end with the same character.

A substring is a contiguous non-empty sequence of characters within a string.


Example 1:

Input: s = "abcba"
Output: 7
Explanation:
The substrings of length 1 that start and end with the same letter are: "a", "b", "c", "b", and "a".
The substring of length 3 that starts and ends with the same letter is: "bcb".
The substring of length 5 that starts and ends with the same letter is: "abcba" .

Example 2:

Input: s = "abacad"
Output: 9   112131
Explanation:
The substrings of length 1 that start and end with the same letter are: "a", "b", "a", "c", "a", and "d" = 6.
The substrings of length 3 that start and end with the same letter are: "aba" and "aca" = 2.
The substring of length 5 that starts and ends with the same letter is: "abaca" = 1.

Example 3:

Input: s = "a"
Output: 1
Explanation:
The substring of length 1 that starts and ends with the same letter is: "a".


Constraints:

1 <= s.length <= 105
s consists only of lowercase English letters.
Question: Maximum Sum Score of an Array

You are given a 0-indexed integer array nums of length n. The sum score of nums at an index i (where 0 <= i < n) is defined as the maximum of:

β€’ The sum of the first i + 1 elements of nums.

β€’ The sum of the last n - i elements of nums.

Your task is to return the maximum sum score of nums at any index.

β–ŽExamples:

1. Input: nums = [4, 3, -2, 5]
Output: 10
Explanation:

β€’ At index 0: max(4, 4 + 3 - 2 + 5) = max(4, 10) = 10.

β€’ At index 1: max(4 + 3, 3 - 2 + 5) = max(7, 6) = 7.

β€’ At index 2: max(4 + 3 - 2, -2 + 5) = max(5, 3) = 5.

β€’ At index 3: max(4 + 3 - 2 + 5, 5) = max(10, 5) = 10.

β€’ The maximum sum score of nums is 10.

2. Input: nums = [-3, -5]
Output: -3
Explanation:

β€’ At index 0: max(-3, -3 - 5) = max(-3, -8) = -3.

β€’ At index 1: max(-3 - 5, -5) = max(-8, -5) = -5.

β€’ The maximum sum score of nums is -3.

β–ŽChallenge:

Write a function maximumSumScore(nums) that takes an integer array as input and returns the maximum sum score.
/*
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 the string "pop", the substring "po" is a special substring, however, "pop" is not special (since 'p' has occurred twice).
Return the number of special substrings.
A substring is a contiguous sequence of characters within a string. For example, "abc" is a substring of "abcd", but "acd" is not.

Example 1:
Input: s = "abcd"


Output: 10
Explanation: Since each character occurs once, every substring is a special substring.
We have 4 substrings of length one, 3 of length two, 2 of length three, and 1 substring of length four. So overall there are 4 + 3 + 2 + 1 = 10 special substrings.

Example 2:
Input: s = "ooo"
Output: 3
Explanation: Any substring with a length of at least two contains a repeating character. So we have to count the number of substrings of length one, which is 3.

Example 3:
Input: s = "abab"
Output: 7
Explanation: Special substrings are as follows (sorted by their start positions):
Special substrings of length 1: "a", "b", "a", "b"
Special substrings of length 2: "ab", "ba", "ab"
And it can be shown that there are no special substrings with a length of at least three. So the answer would be 4 + 3 = 7.
l r
a b c d a

Constraints:
1 <= s.length <= 10^5
s consists of lowercase English letters