en
Feedback
Leetcode with dani

Leetcode with dani

Open in Telegram

Join us and let's tackle leet code questions together: improve your problem-solving skills Preparing for coding interviews learning new algorithms and data structures connect with other coding enthusiasts

Show more
1 258
Subscribers
No data24 hours
+17 days
-730 days
Posts Archive
question from today interview question

Question: Count Substrings with Same Start and End Character Given a string s consisting only of lowercase English letters, your task is to find the number of substrings that start and end with the same character. β–ŽExamples: 1. Input: "abcba" Output: 7 Explanation: The substrings are: "a", "b", "c", "b", "a", "bcb", and "abcba". 2. Input: "abacada" Output: 9 Explanation: The substrings are: "a", "b", "a", "c", "a", "d", "aba", "aca", and "abaca". 3. Input: "a" Output: 1 Explanation: The only substring is "a". 4. Input: "zzzz" Output: 10 Explanation: All substrings start and end with 'z': "z", "z", "z", "z", "zz", "zz", "zz", "zz", "zzz", and "zzzz". β–ŽChallenge: Write a function that takes a string as input and returns the total count of substrings that start and end with the same character.

β–ŽπŸ’° Problem 322: Coin Change Problem Statement: You are given an integer array coins representing coins of different denominations and an integer amount representing a total amount of money. Your task is to return the fewest number of coins that you need to make up that amount. If that amount of money cannot be made up by any combination of the coins, return -1. You may assume that you have an infinite number of each kind of coin. β–ŽExamples: Example 1:
Input: coins = [1, 2, 5], amount = 11
Output: 3
Explanation: 11 can be made up with two 5's and one 1 (5 + 5 + 1).
Example 2:
Input: coins = [2], amount = 3
Output: -1
Explanation: It is not possible to make up the amount 3 with only coin of denomination 2.
Example 3:
Input: coins = [1], amount = 0
Output: 0
Explanation: No coins are needed to make up the amount 0.

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 to rearrange the characters to form a palindrome. Examples: 1. Input: "civic" β€’ Output: True β€’ Explanation: The string is already a palindrome. 2. Input: "ivicc" β€’ Output: True β€’ Explanation: Rearranging the characters can form the palindrome "civic". 3. Input: "hello" β€’ Output: False β€’ Explanation: No rearrangement can form a palindrome. 4. Input: "aabbcc" β€’ Output: True β€’ Explanation: Rearranging the characters can form the palindrome "abcba". 5. Input: "racecar" β€’ Output: True β€’ Explanation: The string is already a palindrome. Challenge: Write a function that takes a string as input and returns True if the string can be rearranged to form a palindrome, and False otherwise.

A2SV N PERSON EDUCATION
Anonymous voting

238. Product of Array Except Self  
Difficulty: Medium  

Problem:  
Given an integer array nums, return an array answer such that answer[i] is the product of all elements of nums except nums[i].  

Conditions:  
- The product of any prefix or suffix of nums is guaranteed to fit in a 32-bit integer.  
- Your algorithm must run in O(n) time and must not use the division operation.  

Examples:  
Input: nums = [1,2,3,4]  
Output: [24,12,8,6]  

Input: nums = [-1,1,0,-3,3]  
Output: [0,0,9,0,0]  

Constraints:  
2 <= nums.length <= 10^5  
-30 <= nums[i] <= 30  

Can you solve it?

**238. Product of Array Except Self**  
**Difficulty**: Medium  

**Problem**:  
Given an integer array `nums`, return an array `answer` such that `answer[i]` is the product of all elements of `nums` except `nums[i]`.  

**Conditions**:  
- The product of any prefix or suffix of `nums` is guaranteed to fit in a 32-bit integer.  
- Your algorithm must run in O(n) time and must not use the division operation.  

**Examples**:  
- Input: `nums = [1,2,3,4]`  
  Output: `[24,12,8,6]`  

- Input: `nums = [-1,1,0,-3,3]`  
  Output: `[0,0,9,0,0]`  

**Constraints**:  
- 2 ≀ nums.length ≀ 10⁡  
- -30 ≀ nums[i] ≀ 30  

Can you solve it?

**238. Product of Array Except Self**  
πŸ’‘ **Difficulty**: Medium  

πŸ” **Problem**:  
Given an integer array `nums`, return an array `answer` such that `answer[i]` is the product of all elements of `nums` except `nums[i]`.  

πŸ‘‰ **Conditions**:  
- The product of any prefix or suffix of `nums` is guaranteed to fit in a 32-bit integer.  
- Your algorithm must run in **O(n)** time and **must not use the division operation**.  

### **Examples**  
**Input**:  
`nums = [1,2,3,4]`  
**Output**:  
`[24,12,8,6]`  

**Input**:  
`nums = [-1,1,0,-3,3]`  
**Output**:  
`[0,0,9,0,0]`  

### **Constraints**  
- `2 <= nums.length <= 105`  
- `-30 <= nums[i] <= 30`  

Can you solve it? 🧩

Repost from A2SV - Discussion
Hello fellow coders, After a brief break, we've returned! Get ready for our fun weekly community coding contest happening every Saturday πŸ—“. It's your chance to compete with other awesome programmers, learn more about coding, and, most importantly, have a great time! πŸ₯³ πŸ† Contest Details: πŸ“… Date: November 23, 2024 ⏰ Time: 6:00 PM πŸ”— Link for Contest: Community Weekly Contest Return - Contest No 3 P.S. Remember to fill out this form to secure your spot for our upcoming community classes and lectures. It’s your golden ticket to enriching experiences you won’t want to miss. πŸ“šβœ¨

🎯 Problem of the Day: Sort Colors Problem Description You are given an array nums with \( n \) objects colored red, white, or blue. Sort the array in-place so that objects of the same color are adjacent, with the colors in the order red, white, and blue. - Represent the colors using integers: - 0 β†’ Red - 1 β†’ White - 2 β†’ Blue ⚠️ Note: You must not use the library's sort function. --- Example 1 Input:
nums = [2,0,2,1,1,0]
Output:
[0,0,1,1,2,2]
Example 2 Input:
nums = [2,0,1]
Output:
[0,1,2]
--- πŸ“ Practice Questions for A2SV Preparation 1. Core Problem: - Solve LeetCode 75: Sort Colors () using Dutch National Flag Algorithm for \( O(n) \) time complexity. 2. Related Problems: - LeetCode 215 : Kth Largest Element in an Array - LeetCode 347 : Top K Frequent Elements - LeetCode 56 : Merge Intervals 3. Challenge Problem: - LeetCode 88: Merge Sorted Array --- πŸ’‘ Tip: Use a two-pointer or three-pointer approach to keep track of boundaries for the different colors! Try to optimize your solution to \( O(n) \) in both time and space. 🧠 Share your solution and discuss your approach with the community! 🌟

Repost from A2SV - Discussion
Hello G6 In-Person Education Applicants, As you gear up for your interviews, we want to inform you about the key topics to focus on. These are the areas that will be covered during the interview: - Sorting - Two Pointers - Sliding Window - Prefix Sum - Stacks and Queues Best of luck with your preparation! Stay confident and ready to showcase your skills.

α‹ˆαŠ•α‹΅αˆ›α‰½αŠ• α‰°αˆ›αˆͺ αŠ α‹²αˆ± αŠ αŒˆα‹˜ α‹¨αŠ .አ.α‹© /CNCS የChemistry α‹²α“αˆ­α‰΅αˆ˜αŠ•α‰΅ α‰°αˆ›αˆͺ αˆ²αˆ†αŠ• α‰ α‹΅αŠ•αŒˆα‰°αŠ› α‹¨αŒ€αŠ“ αŠ₯ክል αˆαŠ­αŠ•α‹«α‰΅ α‰ αŒ₯α‰αˆ­ αŠ αŠ•α‰ αˆ³ αˆ΅α”αˆ»αˆ‹α‹­α‹α‹΅ αˆ†αˆ΅α’α‰³αˆ α‹¨αˆ…αŠ­αˆαŠ“ αŠ­α‰΅α‰΅αˆ αŠ₯α‹¨α‰°α‹°αˆ¨αŒˆαˆˆα‰΅ α‹­
α‹ˆαŠ•α‹΅αˆ›α‰½αŠ• α‰°αˆ›αˆͺ αŠ α‹²αˆ± αŠ αŒˆα‹˜ α‹¨αŠ .አ.α‹© /CNCS የChemistry α‹²α“αˆ­α‰΅αˆ˜αŠ•α‰΅ α‰°αˆ›αˆͺ αˆ²αˆ†αŠ• α‰ α‹΅αŠ•αŒˆα‰°αŠ› α‹¨αŒ€αŠ“ αŠ₯ክል αˆαŠ­αŠ•α‹«α‰΅ α‰ αŒ₯α‰αˆ­ αŠ αŠ•α‰ αˆ³ αˆ΅α”αˆ»αˆ‹α‹­α‹α‹΅ αˆ†αˆ΅α’α‰³αˆ α‹¨αˆ…αŠ­αˆαŠ“ αŠ­α‰΅α‰΅αˆ αŠ₯α‹¨α‰°α‹°αˆ¨αŒˆαˆˆα‰΅ α‹­αŒˆαŠ›αˆα’ αˆ†αŠ–αˆ αŒαŠ• αˆˆαˆ…αŠ­αˆαŠ“αŠ“ αˆˆαŠ αŠ•α‹³αŠ•α‹΅ α‹ˆαŒͺα‹Žα‰½ α‹¨αˆšαˆ†αŠα‹αŠ• αŒˆαŠ•α‹˜α‰₯ αˆ˜αˆΈαˆαŠ• αˆ΅αˆ‹αˆα‰°α‰»αˆˆ ለαŠ₯αˆ­α‹³α‰³ αˆ²α‰£αˆ α‰£αˆˆ3 αŒ₯ምር α‹¨α‰£αŠ•αŠ­ αŠ αŠ«α‹αŠ•α‰΅ α‰°αŠ¨αα‰Ά αŠ α‰…αˆ α‹¨αˆα‰€α‹°α‹αŠ• αŠ₯αŠ“ ልα‰₯ α‹¨α‹ˆα‹°α‹°α‹αŠ• αŒˆα‰’ α‰ αˆ›α‹΅αˆ¨αŒ የαŠ₯αˆ­α‹³α‰³ αŠ₯αŒƒα‰½αˆαŠ• αŠ₯αŠ•α‹΅α‰΅α‹˜αˆ¨αŒ‰αˆαŠ• αˆ΅αŠ•αˆ α‰ αˆαŒ£αˆͺ ሡም αŠ₯αŠ•αŒ α‹­α‰ƒαˆˆαŠ•α’ α‹΅αˆ­ α‰’α‹«α‰₯ር... 1000660602899 Surafel and Lud and Belete (CBE) αˆˆαˆ˜αˆ¨αŒƒ: 0928750009

FOR A2SV

Practive questions for interview.pdf0.52 KB

Practive questions for interview.pdf0.52 KB

Applications are Open for A2SV G6 Education! The time has come for A2SV to welcome new members! We’re looking for team-orient
Applications are Open for A2SV G6 Education! The time has come for A2SV to welcome new members! We’re looking for team-oriented individuals with a never-give-up mentality, ready to drive tech excellence and solve impactful challenges. πŸ“… Application opens: November 14, 2024 πŸ“… Deadline: November 20, 2024, at 11:59 PM EAT πŸŽ“ Eligibility Open to current students from Addis Ababa University (AAU), Addis Ababa Science and Technology University (AASTU), and Adama Science and Technology University (ASTU). If you're not from these schools or have already graduated, stay tuned for future remote applications! πŸ” Requirements - Familiarity with at least one programming language - Experience with platforms like LeetCode or Codeforces - Completed at least 40 problems on LeetCode or Codeforces πŸ€– Selection Process - First Round Filtering: Initial application review - Technical & Behavioral Interviews: For selected candidates, to assess skills and fit for the program βŒ›οΈ Don’t wait! Start your application early to ensure a standout submission. 🎯 πŸ”— Apply now: link #A2SV #TechEducation #EmpoweringAfrica #ApplyNow

αˆ˜αŒ€αˆ˜αˆͺα‹« αˆŠαŠ•αŠ©αŠ• αˆ΅α‰΅αŒ«αŠ‘ Register αŠ α‹΅αˆ­αŒ‰ α‹­αˆ‹α‰Ήαˆ€αˆ αŠ«α‹°αˆ¨αŒ‹α‰Ήαˆ… α‰ αŠ‹αˆ‹ α‹¨αˆ«αˆ³α‰½αˆαŠ• αˆŠαŠ•αŠ­ α‹­αˆ°αŒ£α‰Ήαˆ€αˆ αŠ¨α‹›αˆ αˆˆαŒ“α‹°αŠžα‰»α‰½αˆ α‰ αˆ˜αˆ‹αŠ­ αŠ₯ነሱ α‰ αˆŠαŠ•αŠ«α‰Ήαˆ… αˆ²αŒˆα‰‘ α‰₯ር α‹­αˆ°αŒ£α‰Ήαˆ€αˆ 500 α‰₯ር αˆ²αˆ†αŠ• αˆ›α‹αŒ£α‰΅ α‰΅α‰½αˆ‹αˆ‹α‰Ήαˆ… 100% αŠ₯α‹αŠα‰΅ αŠα‹ αˆˆαˆ˜αŒ€αˆ˜αˆ­πŸ‘‡πŸ‘‡ https://www.vivapay.top?id=MjE1MjA3NjIwODUyOTQwOQ==&from=OTM2NDY0ODk0|MjE1MjA3NjA4ODAwMDUxMg==&lang=en&cid=hbcp&channel=web

Repost from A2SV - Discussion
Hello fellow coders, After a brief break, we've returned! Get ready for our fun weekly community coding contest happening every Saturday πŸ—“. It's your chance to compete with other awesome programmers, learn more about coding, and, most importantly, have a great time! πŸ₯³ πŸ† Contest Details: πŸ“… Date: November 9, 2024 ⏰ Time: 6:00 PM πŸ”— Link for Contest: Community Weekly Contest Return - Contest No 1 P.S. Remember to fill out this form to secure your spot for our upcoming community classes and lectures. It’s your golden ticket to enriching experiences you won’t want to miss. πŸ“šβœ¨