uk
Feedback

Не попадись на ботовода! Telemetrio знаходить і позначає такі канали мітками 👉 Хочеш бачити мітку, оформляй підписку

Leetcode with dani

Leetcode with dani

Відкрити в 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

Показати більше
1 240
Підписники
-124 години
-37 днів
-1730 днів
Архів дописів
409. Longest Palindrome Given a string s which consists of lowercase or uppercase letters, return the length of the longest palindrome that can be built with those letters. Letters are case sensitive, for example, "Aa" is not considered a palindrome. Example 1: Input: s = "abccccdd" Output: 7 Explanation: One longest palindrome that can be built is "dccaccd", whose length is 7. Example 2: Input: s = "a" Output: 1 Explanation: The longest palindrome that can be built is "a", whose length is 1. Constraints: 1 <= s.length <= 2000 s consists of lowercase and/or uppercase English letters only. Submit
03 січ 2025, 06:23

🎄✨ Merry Christmas! 🎄✨ Wishing you all joy, love, and peace this holiday season. As for the New Year… umm, is it appropriate to say "Happy New Year" now? 🤔 I mean, we’re rocking the Ethiopian calendar here! 🗓😎
31 груд 2024, 16:09

If you were interviewed, how was your technical interview?
Anonymous voting
31 груд 2024, 16:05

Mistakes are proof that you’re trying. Embrace every error as a lesson and keep moving forward
31 груд 2024, 11:12

The is the interview question I just had: Given a binary array nums, return the maximum number of consecutive 1's in the array if you can flip at most one 0. Example 1: Input: nums = [1,0,1,1,0] Output: 4 Explanation: - If we flip the first zero, nums becomes [1,1,1,1,0] and we have 4 consecutive ones. - If we flip the second zero, nums becomes [1,0,1,1,1] and we have 3 consecutive ones. The max number of consecutive ones is 4. max_cont= 4 max_count= 3 max_count =4 [1,0,1,1,0] Example 2: Input: nums = [1,0,1,1,0,1] Output: 4 Explanation: - If we flip the first zero, nums becomes [1,1,1,1,0,1] and we have 4 consecutive ones. - If we flip the second zero, nums becomes [1,0,1,1,1,1] and we have 4 consecutive ones. The max number of consecutive ones is 4. Constraints: 1 <= nums.length <= 105 nums[i] is either 0 or 1.
31 груд 2024, 10:21

Have you been interviewed?
Anonymous voting
31 груд 2024, 10:02

Given a string s consisting of lowercase letters only, return the length of the longest alphabetical continuous substring. def longestContinuousSubstring(s: str) -> int: Example 1: Input: s = "abacaba" Output: 2 Explanation: There are 4 distinct continuous substrings: "a", "b", "c" and "ab". "ab" is the longest continuous substring. Example 2: Input: s = "abcde" Output: 5 Explanation: "abcde" is the longest continuous substring. Constraints: 1 <= s.length <= 10^5 s consists of only English lowercase letters. """
31 груд 2024, 06:42
31 груд 2024, ~06:42

you fuck u ]
31 груд 2024, 05:45
31 груд 2024, ~05:45

""" Given a binary array nums, return the maximum number of consecutive 1's in the array. Example 1: Input: nums = [1,1,0,1,1,1] Output: 3 Explanation: The first two digits or the last three digits are consecutive 1s. The maximum number of consecutive 1s is 3. Example 2: Input: nums = [1,0,1,1,0,1] Output: 2 Constraints: 1 <= nums.length <= 105 nums[i] is either 0 or 1. """
31 груд 2024, 05:40

todays interview
31 груд 2024, 05:40

today interview question
30 груд 2024, 04:29

You are given a sorted array nums of size n and an integer target. 
Your task is to find the pair of numbers in the array whose sum is less than or equal to the target and has the largest possible sum.

Return the maximum sum of such a pair. If no valid pair exists, return -1.

Example 1:
Input: nums = [2, 3, 5, 8, 13], target = 10
Output: 10
 l
[2, 3, 5, 8, 13],
          r
[7,8 , 10]
Explanation: The pair (2, 8) has a sum of 10, which is the largest possible sum less than or equal to 10.

Example 2:
Input: nums = [1, 1, 1, 1], target = 1
Output: -1
Explanation: No pair has a sum less than or equal to 1.

Constraints:
1<=n<=10⁵
Nums  is sorted in non-decreasing order.



def targetSum(nums , target):
    left = 0
    max_ = -1
    right = len(nums)-1
    while left < right:
        sum = nums[left] + nums[right]
        if sum == target:
            return sum
        elif sum > target:
            right -=1
        elif sum < target:
            left += 1
            max_ = max(max_,sum)
    return max_
30 груд 2024, 04:28

You are given a 0-indexed string s consisting of only lowercase English letters, and an integer count. A substring of s is said to be an equal count substring if, for each unique letter in the substring, it appears exactly count times in the substring. Return the number of equal count substrings in s. A substring is a contiguous non-empty sequence of characters within a string. Example 1: Input: s = "aaabcbbcc", count = 3 Output: 3 Explanation: The substring that starts at index 0 and ends at index 2 is "aaa". The letter 'a' in the substring appears exactly 3 times. The substring that starts at index 3 and ends at index 8 is "bcbbcc". The letters 'b' and 'c' in the substring appear exactly 3 times. The substring that starts at index 0 and ends at index 8 is "aaabcbbcc". The letters 'a', 'b', and 'c' in the substring appear exactly 3 times. Example 2: Input: s = "abcd", count = 2 Output: 0 Explanation: The number of times each letter appears in s is less than count. Therefore, no substrings in s are equal count substrings, so return 0. Example 3: Input: s = "a", count = 5 Output: 0 Explanation: The number of times each letter appears in s is less than count. Therefore, no substrings in s are equal count substrings, so return 0
29 груд 2024, 10:56

another interview question
You are given a 0-indexed integer array nums.
Swaps of adjacent elements are able to be performed on nums.
A valid array meets the following conditions:
    The largest element (any of the largest elements if there are multiple) is at the rightmost position in the array.
    The smallest element (any of the smallest elements if there are multiple) is at the leftmost position in the array.
Return the minimum swaps required to make nums a valid array.
 
Example 1:
Input: nums = [3,4,5,5,3,1]
Output: 6
Explanation: Perform the following swaps:
- Swap 1: Swap the 3rd and 4th elements, nums is then [3,4,5,3,5,1].
- Swap 2: Swap the 4th and 5th elements, nums is then [3,4,5,3,1,5].
- Swap 3: Swap the 3rd and 4th elements, nums is then [3,4,5,1,3,5].
- Swap 4: Swap the 2nd and 3rd elements, nums is then [3,4,1,5,3,5].
- Swap 5: Swap the 1st and 2nd elements, nums is then [3,1,4,5,3,5].
- Swap 6: Swap the 0th and 1st elements, nums is then [1,3,4,5,3,5].
It can be shown that 6 swaps is the minimum swaps required to make a valid array.

Example 2:
Input: nums = [9]
Output: 0
Explanation: The array is already valid, so we return 0.

    
          
 
Constraints:
1 <= nums.length <= 10^5
1 <= nums[i] <= 10^5
28 груд 2024, 15:13

i am not sure but i heard a news that the G6 result will be announced at the end of next week? did u get the info?
28 груд 2024, 14:39

share urs in the comment section or in the group
28 груд 2024, 12:44

28 груд 2024, 12:41
28 груд 2024, ~13:37

28 груд 2024, 12:40

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: December 28, 2024 ⏰ Time: 6:00 PM 🔗 Link for Contest: Community Weekly Contest - Contest No 7 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. 📚✨
28 груд 2024, 09:48

28 груд 2024, 01:16