'''
You are given an integer array nums. Return the largest integer that occurs exactly once in the array. If no integer occurs once, return -1.
Example 1
Input:
nums = [5,7,3,9,4,9,8,3,1]
Output:
8
Explanation:
The largest value is 9, but it appears twice.
The largest number that appears exactly once is 8.
Example 2
Input:
nums = [9,9,8,8]
Output:
-1
Explanation:
All numbers appear more than once, so return -1.
Constraints
1 <= nums.length <= 2000
0 <= nums[i] <= 1000
'''
You are given an integer array nums. Return the largest integer that occurs exactly once in the array. If no integer occurs once, return -1.
Example 1
Input:
nums = [5,7,3,9,4,9,8,3,1]
Output:
8
Explanation:
The largest value is 9, but it appears twice.
The largest number that appears exactly once is 8.
Example 2
Input:
nums = [9,9,8,8]
Output:
-1
Explanation:
All numbers appear more than once, so return -1.
Constraints
1 <= nums.length <= 2000
0 <= nums[i] <= 1000
'''
'''
You are given an integer n perform the following steps:
Convert each digit of n into its lowercase English word (e.g., 4 → "four", 1 → "one").
Concatenate those words in the original digit order to form a string s.
Return the number of distinct characters in s that appear an odd number of times.
Example 1:
Input: n = 41
Output: 5
Explanation:
41 → "fourone"
Characters with odd frequencies: 'f', 'u', 'r', 'n', 'e'. Thus, the answer is 5.
Example 2:
Input: n = 20
Output: 5
Explanation:
20 → "twozero"
Characters with odd frequencies: 't', 'w', 'z', 'e', 'r'. Thus, the answer is 5.
Constraints:
1 <= n <= 10**9
'''
def converted_inreger(n):
corresponding_lettr ={
0:"zero",
1:"one",
2:"two",
3:"three",
4:"four",
5:"five",
6:"six",
7:"seven",
8:"eight",
9:"nine"
}
coverted = ""
for i in str(n):
coverted += corresponding_lettr[int(i)]
count = 0
freq = {}
for s in coverted:
if s in freq:
freq[s] += 1
else:
freq[s] = 1
for st in freq:
if freq[st] % 2 != 0:
count += 1
return count
res = converted_inreger(41)
print(res)
You are given an integer n perform the following steps:
Convert each digit of n into its lowercase English word (e.g., 4 → "four", 1 → "one").
Concatenate those words in the original digit order to form a string s.
Return the number of distinct characters in s that appear an odd number of times.
Example 1:
Input: n = 41
Output: 5
Explanation:
41 → "fourone"
Characters with odd frequencies: 'f', 'u', 'r', 'n', 'e'. Thus, the answer is 5.
Example 2:
Input: n = 20
Output: 5
Explanation:
20 → "twozero"
Characters with odd frequencies: 't', 'w', 'z', 'e', 'r'. Thus, the answer is 5.
Constraints:
1 <= n <= 10**9
'''
def converted_inreger(n):
corresponding_lettr ={
0:"zero",
1:"one",
2:"two",
3:"three",
4:"four",
5:"five",
6:"six",
7:"seven",
8:"eight",
9:"nine"
}
coverted = ""
for i in str(n):
coverted += corresponding_lettr[int(i)]
count = 0
freq = {}
for s in coverted:
if s in freq:
freq[s] += 1
else:
freq[s] = 1
for st in freq:
if freq[st] % 2 != 0:
count += 1
return count
res = converted_inreger(41)
print(res)
'''
There are n windows open numbered from 1 to n, we want to simulate using alt + tab to navigate between the windows.
You are given an array windows which contains the initial order of the windows (the first element is at the top and the last one is at the bottom).
You are also given an array queries where for each query, the window queries[i] is brought to the top.
Return the final state of the array windows.
Example 1:
Input: windows = [1,2,3], queries =
[3,2,1]
Output: [2,3,1]
Explanation:
Here is the window array after each query:
Initial order: [1,2,3]
After the first query: [3,1,2]
After the second query: [3,1,2]
After the last query: [2,3,1]
Example 2:
Input: windows = [1,4,2,3], queries = [4,1,3]
Output: [3,1,4,2]
Explanation:
Here is the window array after each query:
Initial order: [1,4,2,3]
After the first query: [4,1,2,3]
After the second query: [1,4,2,3]
After the last query: [3,1,4,2]
Constraints:
1 <= n == windows.length <= 10**3
windows is a permutation of [1, n].
1 <= queries.length <= 10**3
1 <= queries[i] <= n
Follow Up: What if the constraint is 10^5?
'''
There are n windows open numbered from 1 to n, we want to simulate using alt + tab to navigate between the windows.
You are given an array windows which contains the initial order of the windows (the first element is at the top and the last one is at the bottom).
You are also given an array queries where for each query, the window queries[i] is brought to the top.
Return the final state of the array windows.
Example 1:
Input: windows = [1,2,3], queries =
[3,2,1]
Output: [2,3,1]
Explanation:
Here is the window array after each query:
Initial order: [1,2,3]
After the first query: [3,1,2]
After the second query: [3,1,2]
After the last query: [2,3,1]
Example 2:
Input: windows = [1,4,2,3], queries = [4,1,3]
Output: [3,1,4,2]
Explanation:
Here is the window array after each query:
Initial order: [1,4,2,3]
After the first query: [4,1,2,3]
After the second query: [1,4,2,3]
After the last query: [3,1,4,2]
Constraints:
1 <= n == windows.length <= 10**3
windows is a permutation of [1, n].
1 <= queries.length <= 10**3
1 <= queries[i] <= n
Follow Up: What if the constraint is 10^5?
'''
❤1
Forwarded from Hi, AI • Tech News
A Reddit user named RailfanHS almost fell for a classic scam: "pay the delivery fee," and your money quietly disappears into the scammer's pocket.
Instead of falling for it, he decided to fight back and built a fake payment page using ChatGPT—all it took was a single prompt:
"Write code for a simple website that looks like a payment gateway, but when it loads, it asks for camera and GPS access, takes a photo, and sends it to the backend."
The AI produced a working solution in a couple of minutes. RailfanHS sent the scammer the link and told him to "scan the QR code to speed up the payment."
The scammer got so scared he started calling back, begging and swearing he'd "quit this job!"
"Satisfaction of stealing from a thief is crazy," the author concluded.
@hiaimediaen
Please open Telegram to view this post
VIEW IN TELEGRAM
😁7
Forwarded from Hanan S.
'''
You are given a 2D integer array of student data students, where students[i] = [student_id, bench_id] represents that student student_id is sitting on the bench bench_id.
Return the maximum number of unique students sitting on any single bench. If no students are present, return 0.
Note: A student can appear multiple times on the same bench in the input, but they should be counted only once per bench.
Example 1:
Input: students = [[1,2],[2,2],[3,3],[1,3],[2,3]]
Output: 3
Explanation:
Bench 2 has two unique students: [1, 2].
Bench 3 has three unique students: [1, 2, 3].
The maximum number of unique students on a single bench is 3.
Example 2:
Input: students = [[1,1],[2,1],[3,1],[4,2],[5,2]]
Output: 3
Explanation:
Bench 1 has three unique students: [1, 2, 3].
Bench 2 has two unique students: [4, 5].
The maximum number of unique students on a single bench is 3.
Example 3:
Input: students = [[1,1],[1,1]]
Output: 1
Explanation:
The maximum number of unique students on a single bench is 1.
Example 4:
Input: students = []
Output: 0
Explanation:
Since no students are present, the output is 0.
Constraints:
0 <= students.length <= 100
students[i] = [student_id, bench_id]
1 <= student_id <= 100
1 <= bench_id <= 100
'''
# max = max(
# iterate 1-n / len array O(n)
# iterate over each rows O(n)
# compare prev row prev index
# if greater update max value
# return max value
# create hash map
# iterate over 0-n/ len arrar
# bech id as key , count
# iterate over the hash map
# return the max value
def counter(arr):
studentCounter = {} # O(n)
for i in range(len(arr)): # O(n)
studentCounter[arr[i][1]] = studentCounter.get(arr[i][1],set())
studentCounter[arr[i][1]].add(arr[i][0])
max_students = 0
for students in studentCounter.values(): # O(m)
max_students = max(max_students, len(students))
return max_students
# time complexity -- O(n+m) = O(n)
# space complexity -- O(n)
students = [[1,2]]
print(counter(students))
You are given a 2D integer array of student data students, where students[i] = [student_id, bench_id] represents that student student_id is sitting on the bench bench_id.
Return the maximum number of unique students sitting on any single bench. If no students are present, return 0.
Note: A student can appear multiple times on the same bench in the input, but they should be counted only once per bench.
Example 1:
Input: students = [[1,2],[2,2],[3,3],[1,3],[2,3]]
Output: 3
Explanation:
Bench 2 has two unique students: [1, 2].
Bench 3 has three unique students: [1, 2, 3].
The maximum number of unique students on a single bench is 3.
Example 2:
Input: students = [[1,1],[2,1],[3,1],[4,2],[5,2]]
Output: 3
Explanation:
Bench 1 has three unique students: [1, 2, 3].
Bench 2 has two unique students: [4, 5].
The maximum number of unique students on a single bench is 3.
Example 3:
Input: students = [[1,1],[1,1]]
Output: 1
Explanation:
The maximum number of unique students on a single bench is 1.
Example 4:
Input: students = []
Output: 0
Explanation:
Since no students are present, the output is 0.
Constraints:
0 <= students.length <= 100
students[i] = [student_id, bench_id]
1 <= student_id <= 100
1 <= bench_id <= 100
'''
# max = max(
# iterate 1-n / len array O(n)
# iterate over each rows O(n)
# compare prev row prev index
# if greater update max value
# return max value
# create hash map
# iterate over 0-n/ len arrar
# bech id as key , count
# iterate over the hash map
# return the max value
def counter(arr):
studentCounter = {} # O(n)
for i in range(len(arr)): # O(n)
studentCounter[arr[i][1]] = studentCounter.get(arr[i][1],set())
studentCounter[arr[i][1]].add(arr[i][0])
max_students = 0
for students in studentCounter.values(): # O(m)
max_students = max(max_students, len(students))
return max_students
# time complexity -- O(n+m) = O(n)
# space complexity -- O(n)
students = [[1,2]]
print(counter(students))
Channel Summary for 2025 🎉
Views
• 472 Total Posts
• 501 Average Views
• 236,817 Total Views
Top Post
• 2,058 Views
• https://news.1rj.ru/str/leetcodeQ/1131
Activity
• 7 PM is when you were most active
• Wednesday is your most active day
• February is your most active month
@channel_unwrapped_bot #channel_unwrapped
Views
• 472 Total Posts
• 501 Average Views
• 236,817 Total Views
Top Post
• 2,058 Views
• https://news.1rj.ru/str/leetcodeQ/1131
Activity
• 7 PM is when you were most active
• Wednesday is your most active day
• February is your most active month
@channel_unwrapped_bot #channel_unwrapped
⚡5
I am building a Taxi Mela mobile app with my team for our final year project.
You can find taxi stations.
You can search using destinations, see the route, and the taxi fare.
Would you use this app? How would you rate its importance? Please give me any recommendations in the comments or inbox.
You can find taxi stations.
You can search using destinations, see the route, and the taxi fare.
Would you use this app? How would you rate its importance? Please give me any recommendations in the comments or inbox.
⚡6
from 10 rate the app usefullness for u
Anonymous Poll
48%
9-10
16%
7-8
13%
4-6
6%
<3
17%
see the result
👍5