Competitive Programming
Відкрити в Telegram
Solving competitive Programming Questions one day at a time. Group link: https://t.me/daily1interviewprogram Please forward it to your friends
Показати більшеКраїна не вказанаКатегорія не вказана
4 553
Підписники
Немає даних24 години
Немає даних7 днів
Немає даних30 день
Архів дописів
If you feel that I have helped you to improve your programming skill, I request you to please give a 5 star rating in below link.
https://tchannels.me/c/daily1interviewprogram
Day 34 Question:
Group Anagrams
Given an array of strings, group anagrams together.
Example:
Input: ["eat", "tea", "tan", "ate", "nat", "bat"],
Output:
[
["ate","eat","tea"],
["nat","tan"],
["bat"]
]
Note:
All inputs will be in lowercase.
The order of your output does not matter.
Difficulty: Medium
Asked in companies: Amazon Microsoft
Motivational quote for the day:
There is no substitute for hard work. Never give up. Never stop believing. Never stop fighting.
Note:
I am aware that I am not providing solutions daily EOD as told, as I am facing some technical difficulties. Hopefully it will be resolved by Sunday.
Sorry, below is the correct Day 30th solution link:
https://www.prodevelopertutorial.com/given-two-non-negative-integers-num1-and-num2-represented-as-strings-return-the-product-of-num1-and-num2-also-represented-as-a-string/
Day 33 Question:
You are given an n x n 2D matrix representing an image.
Rotate the image by 90 degrees (clockwise).
Note:
You have to rotate the image in-place, which means you have to modify the input 2D matrix directly. DO NOT allocate another 2D matrix and do the rotation.
Example 1:
Given input matrix =
[
[1,2,3],
[4,5,6],
[7,8,9]
],
rotate the input matrix in-place such that it becomes:
[
[7,4,1],
[8,5,2],
[9,6,3]
]
Difficulty: Medium
Companies asked: Google Facebook Amazon
================================================================================
Hope you have solved Day 30th question.
Day 30th Question:
Given two non-negative integers num1 and num2 represented as strings, return the product of num1 and num2, also represented as a string.
Solution:
https://www.prodevelopertutorial.com/given-a-collection-of-distinct-integers-return-all-possible-permutations/
Please comment with your answers in the comment section of the above post.
Companies asked: Microsoft Flipkart Adobe Facebook
Hope you have solved Day 29th question.
Day 29th Question:
Given a collection of candidate numbers and a key, find all unique combinations in candidates where the candidate numbers sums to target
Solution:
https://www.prodevelopertutorial.com/given-a-collection-of-candidate-numbers-and-a-key-find-all-unique-combinations-in-candidates-where-the-candidate-numbers-sums-to-target/
Please comment with your answers in the comment section of the above post.
Day 32 Question:
Given a collection of numbers that might contain duplicates, return all possible unique permutations.
Example:
Input: [1,1,2]
Output:
[
[1,1,2],
[1,2,1],
[2,1,1]
]
Difficulty: Medium
Companies asked: Microsoft Facebook Google
Hope you have solved Day 27th question.
Day 27 Question:
Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.
(i.e., [0,1,2,4,5,6,7] might become [4,5,6,7,0,1,2]).
You are given a target value to search. If found in the array return its index, otherwise return -1.
You may assume no duplicate exists in the array.
Your algorithm's runtime complexity must be in the order of O(log n).
Solution:
https://www.prodevelopertutorial.com/given-an-array-sorted-in-ascending-order-and-is-rotated-at-some-pivot-given-a-target-value-to-search-if-found-in-the-array-return-its-index/
Please comment with your answers in the comment section of the above post.
Hope you have solved Day 26th question.
Day 26 Question:
Next Permutation
Solution:
https://www.prodevelopertutorial.com/implement-next-permutation-which-rearranges-numbers-into-the-lexicographically-next-greater-permutation-of-numbers/
Please comment with your answers in the comment section of the above post.
Day 31 question
Given a collection of distinct integers, return all possible permutations.
Example:
Input: [1,2,3]
Output:
[
[1,2,3],
[1,3,2],
[2,1,3],
[2,3,1],
[3,1,2],
[3,2,1]
]
Note: The solution for previous questions will be provided soon.
A J:
Wow, it has been 1 month since we have started this journey and successfully completed 30 competitive programming questions. Kudos to you guys. I have faced many ups and downs in these 30 days and constantly improved myself by taking feedback from you guys. I am proud to say that we have made a community of 1000 members across all the groups in this short period of time. And continue to grow day by day. Please spread the good word amoung your friends and other WhatsApp/Telegram groups.
Please share the below link:
Telegram Channel:
https://t.me/daily1interviewprogram
Day 30 Question:
Given two non-negative integers num1 and num2 represented as strings, return the product of num1 and num2, also represented as a string.
Example 1:
Input: num1 = "2", num2 = "3"
Output: "6"
Example 2:
Input: num1 = "123", num2 = "456"
Output: "56088"
Note:
The length of both num1 and num2 is < 110.
Both num1 and num2 contain only digits 0-9.
Both num1 and num2 do not contain any leading zero, except the number 0 itself.
You must not use any built-in BigInteger library or convert the inputs to integer directly.
Difficulty: Medium
Quote for the day:
The fruit of your own hard work is the sweetest.
Day 29 Question:
Given a collection of candidate numbers (candidates) and a target number (target), find all unique combinations in candidates where the candidate numbers sums to target.
Each number in candidates may only be used once in the combination.
Note:
All numbers (including target) will be positive integers.
The solution set must not contain duplicate combinations.
Example 1:
Input: candidates = [10,1,2,7,6,1,5], target = 8,
A solution set is:
[
[1, 7],
[1, 2, 5],
[2, 6],
[1, 1, 6]
]
Example 2:
Input: candidates = [2,5,2,1,2], target = 5,
A solution set is:
[
[1,2,2],
[5]
]
Difficulty: Medium
Programming quote for the day:
“ Any fool can write code that a computer can understand. Good programmers write code that humans can understand. ” - Martin Fowler
Day 28 Question:
Merge k Sorted Lists
Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.
Example:
Input:
[
1->4->5,
1->3->4,
2->6
]
Output: 1->1->2->3->4->4->5->6
Difficulty: Hard
Programming quote for the day:
“ Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. ” - Rick Osborne
Hope you have solved todays 25th question.
Day 25 Question:
Divide Two Integers
Solution:
https://www.prodevelopertutorial.com/divide-two-integers-without-using-multiplication-division-and-mod-operator/
Please comment with your answers in the comment section of the above post.
I request everyone to solve the questions daily, even if you have solved them earlier. It gives you good understanding about the subject.
Day 27 Question:
Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.
(i.e., [0,1,2,4,5,6,7] might become [4,5,6,7,0,1,2]).
You are given a target value to search. If found in the array return its index, otherwise return -1.
You may assume no duplicate exists in the array.
Your algorithm's runtime complexity must be in the order of O(log n).
Example 1:
Input: nums = [4,5,6,7,0,1,2], target = 0
Output: 4
Example 2:
Input: nums = [4,5,6,7,0,1,2], target = 3
Output: -1
Difficulty: Medium
Programming quote for the day:
“ First, solve the problem. Then, write the code. ” - John Johnson
Day 26 Question:
Next Permutation
Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.
If such arrangement is not possible, it must rearrange it as the lowest possible order (ie, sorted in ascending order).
The replacement must be in-place and use only constant extra memory.
Here are some examples. Inputs are in the left-hand column and its corresponding outputs are in the right-hand column.
1,2,3 → 1,3,2
3,2,1 → 1,2,3
1,1,5 → 1,5,1
Difficulty: Medium
Programming quote for the day:
“ Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it. ” - Brian Kernighan
Hope you have solved Day 24rd question.
Day 24 Question:
Swap Nodes in Pairs
Solution:
https://www.prodevelopertutorial.com/swap-nodes-in-pairs/
Please comment with your answers in the comment section of the above post.
companies asked: Moonfrog Labs, Microsoft, Amazon
Hope you have solved Day 23rd question.
Day 23 Question:
Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.
Solution:
https://www.prodevelopertutorial.com/merge-two-sorted-linked-lists-and-return-it-as-a-new-list-in-c/
Please comment with your answers in the comment section of the above post.
companies asked: Accolite Microsoft Amazon FactSet Flipkart Oracle Samsung MakeMyTrip Brocade
Day 25 Question:
Given two integers dividend and divisor, divide two integers without using multiplication, division and mod operator.
Input: dividend = 10, divisor = 3
Output: 3
Difficulty: Medium
Please write your solution in comment section of the post below:
https://www.prodevelopertutorial.com/divide-two-integers-without-using-multiplication-division-and-mod-operator/
Programming quote for the day:
“ Walking on water and developing software from a specification are easy if both are frozen. ” - Edward V Berard
Day 20 Question:
Remove Nth Node From End of List
Solution:
https://www.prodevelopertutorial.com/remove-nth-node-from-end-of-list/
Please comment with your answers in the comment section of the above post.
