Leetcode with dani
1.29K subscribers
202 photos
14 videos
56 files
243 links
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
Download Telegram
Leetcode with dani
Palindrome number
share ur ides on the comment section
it is the first hard question to be solved by me 😁
πŸŽ‰4πŸ‘1
if you are interested to learn python join this group Python
Forwarded from Gizeale Wondie
left = 0
x = str(x)
right = len(x)-1
while left<= right:
if x[left]!= x[right]:
return False
left+=1
right-=1
return True
Forwarded from F
x = str(x)
return x[::-1] == x
αˆαˆ΅αŒ‰αŠ• αŠα‹ α‰ αŠ­α‰α‹Žα‰½ ምክር α‹«αˆαˆ„α‹°α₯ α‰ αŠƒαŒ’αŠ α‰°αŠžα‰½αˆ αˆ˜αŠ•αŒˆα‹΅ α‹«αˆα‰†αˆ˜α₯ α‰ α‹‹α‹˜αŠžα‰½αˆ α‹ˆαŠ•α‰ αˆ­ α‹«αˆα‰°α‰€αˆ˜αŒ α’
ነገር αŒαŠ• α‰ αŠ₯αŒα‹šαŠ Β·α‰ αˆ”αˆ­ αˆ•αŒ α‹°αˆ΅ α‹­αˆˆα‹‹αˆα₯ αˆ•αŒ‰αŠ•αˆ α‰ α‰€αŠ•αŠ“ α‰ αˆŒαˆŠα‰΅ α‹«αˆ΅α‰£αˆα‘α‘
αŠ₯ርሱም α‰ α‹αŠƒ αˆαˆ³αˆΎα‰½ α‹³αˆ­ αŠ₯αŠ•α‹° α‰°α‰°αŠ¨αˆˆα‰½α‘ ααˆ¬α‹‹αŠ• α‰ α‹¨αŒŠα‹œα‹‹ αŠ₯αŠ•α‹°αˆα‰΅αˆ°αŒ₯ፑ α‰…αŒ αˆα‹‹αˆ αŠ₯αŠ•α‹°αˆ›α‹­αˆ¨αŒα ዛፍ α‹­αˆ†αŠ“αˆα€ α‹¨αˆšαˆ αˆ«α‹αˆ αˆαˆ‰ α‹­αŠ¨αŠ“α‹ˆαŠ•αˆˆα‰³αˆα’
αŠ­α‰α‹Žα‰½ αŠ₯αŠ•α‹²αˆ… αŠ α‹­α‹°αˆ‰αˆα‘ ነገር αŒαŠ• αŠα‹αˆ΅ ጠርጎ αŠ₯αŠ•α‹°αˆšα‹ˆαˆ΅α‹°α‹ ቡቒያ αŠ“α‰Έα‹... αˆ΅αˆˆα‹šαˆ… αŠ­α‰α‹Žα‰½ α‰ ααˆ­α‹΅α₯ αŠƒαŒ’αŠ α‰°αŠžα‰½αˆ α‰ αŒ»α‹΅α‰ƒαŠ• αˆ›αŠ…α‰ αˆ­ αŠ α‹­α‰†αˆ™αˆα’
αŠ₯αŒα‹šαŠ α‰₯αˆ”αˆ­ α‹¨αŒ»α‹΅α‰ƒαŠ•αŠ• αˆ˜αŠ•αŒˆα‹΅ α‹«α‹α‰ƒαˆαŠ“α₯ α‹¨αŠ­α‰α‹Žα‰½ αˆ˜αŠ•αŒˆα‹΅ αŒαŠ• α‰΅αŒ α‹αˆˆα‰½α’
❀9
I strongly recommend starting to do LeetCode questions as early as possible. Whether you use it in real life or not, many companies ask for this skill during technical interviews, and it's not likely to change anytime soon. So, do as many problems as you can. Thanks!
πŸ‘4πŸ’―2
Leetcode with dani pinned Β«I strongly recommend starting to do LeetCode questions as early as possible. Whether you use it in real life or not, many companies ask for this skill during technical interviews, and it's not likely to change anytime soon. So, do as many problems as you can.…»
It is really helpful if you want to learn python.
How many of you know about the binary search algorithm?
Anonymous Poll
57%
yess βœ‹
43%
noooπŸ˜…
This media is not supported in your browser
VIEW IN TELEGRAM
Binary Search Algorithm in 100 Seconds
πŸ‘3
we will try to solve some problems on binary search so be ready.πŸ₯Ά
🫑4πŸ‘1
704. Binary Search #Easy #leet_code_Q5 #binary_search Given an array of integers nums which is sorted in ascending order, and an integer target, write a function to search target in nums. If target exists, then return its index. Otherwise, return -1.

You must write an algorithm with O(log n) runtime complexity.

Example 1:

Input: nums = [-1,0,3,5,9,12], target = 9
Output: 4
Explanation: 9 exists in nums and its index is 4
Example 2:

Input: nums = [-1,0,3,5,9,12], target = 2
Output: -1
Explanation: 2 does not exist in nums so return -1
πŸ‘5
Leetcode with dani
704. Binary Search #Easy #leet_code_Q5 #binary_search Given an array of integers nums which is sorted in ascending order, and an integer target, write a function to search target in nums. If target exists, then return its index. Otherwise, return -1. You…
``` class Solution:
def search(self, nums: List[int], target: int) -> int:
left = 0
right = len(nums)-1
while(left<=right):
mid = (left+right)//2
if nums[mid] == target:
return mid
elif nums[mid] >target:
right = mid -1
else:
left = mid+1
return -1
```
πŸ‘5