Day - 56

Day - 56

Assalamu alaykum, everyone! How are you?


I am trying with my best to complete my challenge successfully. Today is the 56th day of my coding challenge and we passed more than half part of my challenge. Sometimes it is hard to solve even one problem, but I tried. I think I am going well but it is not enough for succeed. Because, I do not think I got something I want. Right, I got something from this challenge but I want to learn more and more. So, I am planning to start another challenge to make my skills better. I think you will support my anytime! Thank you for your valuable time.


  1. Problem 121. Best Time to Buy and Sell Stock

/*
?* @param {number[]} prices
?* @return {number}
?*/

var maxProfit = function (prices) {
? let max_profit = 0,
? ? k = 0,
? ? i = 0;
? while (i < prices.length) {
? ? if (prices[i] > prices[k]) {
? ? ? let profit = prices[i] - prices[k];
? ? ? max_profit = Math.max(max_profit, profit);
? ? } else {
? ? ? k = i;
? ? }
? ? i++;
? }
? return max_profit;
};        

2. Problem 575. Distribute Candies

/*
?* @param {number[]} candyType
?* @return {number}
?*/

var distributeCandies = function (candyType) {
? return Math.min(
    candyType.length / 2, new Set(candyType).size
  );
};        

That's all I am going to share with you. Thank for your attention as well. I think you like it, and I want you share this article with your friends as well. Do not forget to follow for more solutions if you are newcomer!


#coding #challenges #solutions #problems #leetcode #100daysofcodechallenge #algorithms #javascript #typescript

Dilshodbek Otajonov

Software developer, Java

1 年

Good luck bro, friendly advice don’t just show your solution, give details on how and why, also state which algorithms you used, time and memory complexity of solution.

要查看或添加评论,请登录

Abbosbek Sulaymonov的更多文章

  • Hey, how long will this task take?

    Hey, how long will this task take?

    A PM walks up to a developer and asks, "Can you build this feature? When will it be done?" The developer pauses. If…

    2 条评论
  • Polyfills in JavaScript

    Polyfills in JavaScript

    Assalamu alaykum, everyone! I haven't been able to write anything for a long time. I hope you will forgive me for this.

  • Day - 100

    Day - 100

    Assalamu alaykum, everyone! And finally, today is the last day of my 100-day challenge. Getting to this day has not…

    2 条评论
  • Day - 99

    Day - 99

    Assalamu alaykum, everyone! How are you guys? It is the 99th day of my coding challenge! So, I am going to post a good…

    1 条评论
  • Day - 98

    Day - 98

    Assalamu alaykum, everyone! It is time to share the 98th day of my coding challenge! These days, I am solving problems…

  • Day - 97

    Day - 97

    Assalomu alaykum, everyone! It is the 97th day! I am glad to see you here! Today I am going to show a solution for…

    1 条评论
  • Day - 96

    Day - 96

    Assalamu alaykum, everyone! It is the 96th day of my coding challenge! We passed 96 days ). It is a great result! I…

  • Day - 95

    Day - 95

    Assalamu alaykum, everyone! Today, I am going to share the 95th day of my coding challenge! So, let's start the coding!…

  • Day - 94

    Day - 94

    Assalamu alaykum, everyone! It is the 94th day of my coding challenge! I do not know how to describe my thoughts! So…

  • Day - 93

    Day - 93

    Assalomu alaykum, everyone! I am glad to see you here! It is the 93rd day of my coding challenge! So, let's start the…

社区洞察

其他会员也浏览了