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.
Input: nums = [6,5,4,8] Output: [2,1,0,3]
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 firstname.lastname@example.org we want to hear from you!
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!
The DLU Team