You are given an integer array of prices where prices[i] is the price of a given stock on an ith day. Design an algorithm to find the maximum profit.

Some constraints are as follows:

- You may complete at most k transactions.
- You may not engage in multiple transactions simultaneously (i.e., you must sell the stock before you buy again).

Example 1:

`Input: k = 2, prices = [2,4,1]`

Output: 2

Explanation: Buy on day 1 (price = 2) and sell on day 2 (price = 4), profit = 4-2 = 2.

Example 2:

`Input: k = 2, prices = [3,2,6,5,0,3]`

Output…

Solutions to all the exercises on the Tour of Go Website.

The Tour of Go Website is an excellent start for an developer trying to learn the language Go. It gradually introduces you to the language by explaining different parts and provides exercises to the reader to implement.

Following are the solutions I wrote for the exercises as I went through the tour.

There are N children standing in a line and each child is assigned a rating value. You are giving candies to these children while making sure that each child must have at least one candy and children with a higher rating get more candies than their neighbors. What is the minimum candies you must give?

- Input: [1 ,0 , 2] | Output: 5 {
**Distribution**: [2, 1, 2] } - Input: [1, 2, 2] | Output: 4 {
**Distribution**: [2, 1, 1] } - Input: [0, 2, 0, 6, 6] | Output: 7 {
**Distribution**:[1, 2, 1, 2, 1] }

Basically, every…

Find the minimum number of egg drops needed to know the lowest floor in a building from which an egg won’t break.

There are** E eggs (= allowed egg breaks)**, a building with **F** **floors** [**1 ≥ F] **and** **a special floor** S** [**0 ≤ S ≤ F] -** any unbroken egg dropped at a floor higher than S** **will break and any egg dropped at or below this floor will not break.

Given that an unbroken egg can be dropped from any floor, what is the minimum number of **egg drops D [1 ≤ D ≤ F] **needed** **in…

LeetCode: Given a string s, find the longest palindromic substring in s.

A palindrome is a word that reads the same forwards and backwards. In my universe, there are two kinds of palindrome: ** “Odd Pal”** and

Even Pal is a palindrome which has an even length, for example: “ZYXXYZ”. In the visualization below you can see how we can split it into 2 parts that have size 3: “ZYX” and “XYZ” . This palindrome will always have two centres called **“ Left Center”** at index2 and

Notice that:

- character at index2 = character at index3…

I have been recently asked a question: “Where can I start learning about AWS (Amazon Web Services) as a beginner ?”

There are lots of resources you can learn AWS from; following are 6 different ways that I know of:

- AWS Self-Paced Labs:

💡 Individual Lab: Learn a single AWS Service.

💡 Quest Labs: Multiple labs to learn related AWS Services. - Play around with 60+ services with the following AWS Free Tier options:

💡 Free for life.

💡 Free for 12 months post sign-up date.

💡 Short-term offer post service-activation date. - Read and follow:

💡 AWS Documentation

💡 AWS WhitePapers…

Anum Sarmad Malik | Software Engineer @ Apple Siri | twitter.com/anumsarmadmalik | dev.to/anumsmalik