📰 “Your life is a story of transition. You are always leaving one chapter behind while moving on to the next.” – Anonymous
The Coding Puzzle 🧩
Last week's puzzle:
Given a string, write a function to check if it is a permutation of a palindrome. A palindrome is a word or phrase that is the same forwards and backwards. A permutation is a rearrangement of letters. The palindrome does not need to be limited to just dictionary words.
Solution for last week's problem:
def canFormPalindrome(s):
bitvector = 0
for str in s:
bitvector ^= 1 << ord(str)
return bitvector == 0 or bitvector & (bitvector - 1) == 0
#s = input()
if canFormPalindrome("racecar"):
print('Yes')
else:
print('No')
This week's puzzle:
Given the array nums, for each nums[i] find out how many numbers in the array are smaller than it. That is, for each nums[i] you have to count the number of valid j's such that j != i and nums[j] < nums[i].
Return the answer in an array.
Example 1:
Input: nums = [6,5,4,8] Output: [2,1,0,3]
Example 2:
Input: nums = [7,7,7,7] Output: [0,0,0,0]
Developer Shares & Headlines 📢
❇️ Great Talks here! The DevOps Video Library
❇️ Classes that can get you into AI
❇️ Angular vs React vs Vue: Which Framework to Choose in 2021
Want to recommend someone for our developer spotlight, developer event, or just say hello? Send us an email at yourfriends@devslike.us we want to hear from you!
Social 💻
YouTube | Podcast | Instagram | Website | Twitter
The Cast on Twitter: Terrence | Clarence | JB
Well, that's all we have for this week's issue. A quick reminder to add our Podcast on your favorite platform and subscribe to our YouTube page!
Sincerely,
The DLU Team