Kun masalasi: 1207. Unique Number of Occurrences
Qiyinlik darajasi: Easy
Qiyinlik darajasi: Easy
LeetCode
Unique Number of Occurrences - LeetCode
Can you solve this real interview question? Unique Number of Occurrences - Given an array of integers arr, return true if the number of occurrences of each value in the array is unique or false otherwise.
Example 1:
Input: arr = [1,2,2,1,1,3]
Output:โฆ
Example 1:
Input: arr = [1,2,2,1,1,3]
Output:โฆ
๐1
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
LeetCode
Determine if String Halves Are Alike - LeetCode
Can you solve this real interview question? Determine if String Halves Are Alike - You are given a string s of even length. Split this string into two halves of equal lengths, and let a be the first half and b be the second half.
Two strings are alike ifโฆ
Two strings are alike ifโฆ
image_2022-12-01_09-25-00.png
181.2 KB
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
LeetCode
Determine if Two Strings Are Close - LeetCode
Can you solve this real interview question? Determine if Two Strings Are Close - Two strings are considered close if you can attain one from the other using the following operations:
* Operation 1: Swap any two existing characters.
* For example, abcdeโฆ
* Operation 1: Swap any two existing characters.
* For example, abcdeโฆ
๐4
tg_image_1592388437.jpeg
132.2 KB
Please open Telegram to view this post
VIEW IN TELEGRAM
๐2
Qiziqishingiz mumkin yuqoridagi kodda sort ishlatilgan va nima uchun bu kod ning time complexity si
NLogN
emas deb, toโgโri. Sortlash uchun NLogN
. lekin bizdagi array ning hajmi 26 va bu array ni saralash uchun 26*log(26)
. Lekin, buni hisoblab koโrsak 200 dan ham kam bu esa const time hisoblanadi. Unda nima uchun O(1)
boโlmadi deb oโylayotgan boโlsangiz tepadagi 2 ta soโzlarning uzunligi maximum 10ห5
ekanligi berilgan va biz ularni massiv shakliga keltirib toโliq yurib chiqdik bu esa O(N)
. Shunday qilib: O(N) + O(1) = O(N)
.๐4
Har bir thread ning o'zining nomi bor(by default). Biz xohlagan threadimiz uchun o'zimiz xohlagan nomni bera olamizmi?
Anonymous Quiz
64%
ha albatta, myThread.setName(โsome nameโ)
36%
yoโq, har bir thread uchun java o'zi nom qo'yadi, masalan Thread-0, Thread-1 โฆ
๐1
Yuqoridagi methoddan bir vaqtda faqat bir thread foylanishini qanday ta'minlasa bo'ladi?
Anonymous Quiz
36%
void kalit so'zi oldidan synchronized kalit so'zini yozish kerak
40%
method nomi oldidan synchronized kalit so'zini yozish kerak
20%
buni method ni o'zgartirish orqali amalga oshirib bo'lmaydi
4%
buni umuman iloji yo'q
Savol: Deadlock nima?
Javobingizni kommentda qoldiring...
Please open Telegram to view this post
VIEW IN TELEGRAM
Biror maqsadga erishish uchun eng asosiy kerak boโladigan narsalar:
1. Intention(niyat)
2. Discipline(intizom)
3. Consistency(doimiylik, uzluksizlik)
Majburiy emas, ammo juda katta yordam beradigani esa bu:
Keling birgalikda 14 kunlik Data-Structure study-plan ni oโzimiz uchun challenge qilamiz va har kuni yechimlar bilan boโlishamiz. Balkim video koโrinishidagi yechimlar ham taโminlanar. Birgalikda har kuni taxminan 2 3 ta masala yechish orqali Data Structure ga oid bilimlarimizni oshirib va yangilab olamiz. Ohirida esa badge ga ham ega boโlamiz.
Telegram: JavaHereBlogs
Youtube: JavaIsHere
Please open Telegram to view this post
VIEW IN TELEGRAM
LeetCode
Study Plan - LeetCode
Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.
Keling ertaga, dushanbadan, 2023-yildan emas
Bugundan boshlaymiz yani 3-dekabrdan.
Shior: Let you start today!
Bugundan boshlaymiz yani 3-dekabrdan.
Shior: Let you start today!
๐14
Please open Telegram to view this post
VIEW IN TELEGRAM
LeetCode
Sort Characters By Frequency - LeetCode
Can you solve this real interview question? Sort Characters By Frequency - Given a string s, sort it in decreasing order based on the frequency of the characters. The frequency of a character is the number of times it appears in the string.
Return the sortedโฆ
Return the sortedโฆ
โก1
tg_image_3152687319.jpeg
270.2 KB
Please open Telegram to view this post
VIEW IN TELEGRAM
โก1
Please open Telegram to view this post
VIEW IN TELEGRAM
LeetCode
Contains Duplicate - LeetCode
Can you solve this real interview question? Contains Duplicate - Given an integer array nums, return true if any value appears at least twice in the array, and return false if every element is distinct.
Example 1:
Input: nums = [1,2,3,1]
Output: trueโฆ
Example 1:
Input: nums = [1,2,3,1]
Output: trueโฆ
โก1
tg_image_1331039773.jpeg
105 KB
Please open Telegram to view this post
VIEW IN TELEGRAM
โก1
Please open Telegram to view this post
VIEW IN TELEGRAM
LeetCode
Maximum Subarray - LeetCode
Can you solve this real interview question? Maximum Subarray - Given an integer array nums, find the subarray with the largest sum, and return its sum.
Example 1:
Input: nums = [-2,1,-3,4,-1,2,1,-5,4]
Output: 6
Explanation: The subarray [4,-1,2,1] hasโฆ
Example 1:
Input: nums = [-2,1,-3,4,-1,2,1,-5,4]
Output: 6
Explanation: The subarray [4,-1,2,1] hasโฆ
โก1