11 short programming problems to stretch your imagination and make sure you are staying on your toes.

(Starting with the simple ones, they get more fun as you move towards the end.)

🧵👇

1. Write a function that reverses an array in place.

In other words, the function should not use an auxiliary array to do the work.
2. Write a function that finds the missing number in an unsorted array containing every one of the other 99 numbers ranging from 1 to 100.
3. Write a function that finds the duplicate number in an unsorted array containing every number from 1 to 100.

Only one of the numbers will appear twice.
4. Write a function that removes every duplicate value in an array.

There could be more than one value duplicated. You should remove all of them leaving a single copy of the value.
5. Write a function that finds the largest and smallest number in an unsorted array.
6. Write a function that finds a subarray whose sum is equal to a given value.
7. Write a function that finds the contiguous subarray of a given size with the largest sum.
8. Write a function that, given two arrays, finds the longest common subarray present in both of them.
9. Write a function that, given two arrays, finds the length of the shortest array that contains both input arrays as subarrays.
10. Write a function that, given an array, determines if you can partition it in two separate subarrays such that the sum of elements in both subarrays is the same.
11. Write a function that, given an array, divides it into two subarrays, such as the absolute difference between their sums is minimum.
I'd love to see some answers!

If you want more content on software engineering, machine learning, and adjacent topics, give me a follow. I post threads like this every week. You can enjoy more of this content here: @svpino.

More from Santiago

More from Tech

You May Also Like

🌿𝑻𝒉𝒆 𝒔𝒕𝒐𝒓𝒚 𝒐𝒇 𝒂 𝑺𝒕𝒂𝒓 : 𝑫𝒉𝒓𝒖𝒗𝒂 & 𝑽𝒊𝒔𝒉𝒏𝒖

Once upon a time there was a Raja named Uttānapāda born of Svayambhuva Manu,1st man on earth.He had 2 beautiful wives - Suniti & Suruchi & two sons were born of them Dhruva & Uttama respectively.
#talesofkrishna https://t.co/E85MTPkF9W


Now Suniti was the daughter of a tribal chief while Suruchi was the daughter of a rich king. Hence Suruchi was always favored the most by Raja while Suniti was ignored. But while Suniti was gentle & kind hearted by nature Suruchi was venomous inside.
#KrishnaLeela


The story is of a time when ideally the eldest son of the king becomes the heir to the throne. Hence the sinhasan of the Raja belonged to Dhruva.This is why Suruchi who was the 2nd wife nourished poison in her heart for Dhruva as she knew her son will never get the throne.


One day when Dhruva was just 5 years old he went on to sit on his father's lap. Suruchi, the jealous queen, got enraged and shoved him away from Raja as she never wanted Raja to shower Dhruva with his fatherly affection.


Dhruva protested questioning his step mother "why can't i sit on my own father's lap?" A furious Suruchi berated him saying "only God can allow him that privilege. Go ask him"