Yahoo India Web Search

Search results

  1. www.hackerrank.com › challenges › poisonous-plantsPoisonous Plants | HackerRank

    Function Description. Complete the function poisonousPlants in the editor below. poisonousPlants has the following parameter (s): int p [n]: the pesticide levels in each plant. Returns. - int: the number of days until plants no longer die from pesticide. Input Format. The first line contains an integer , the size of the array .

  2. Poisonous Plants | HackerRank Solutions. Problem Statement : There are a number of plants in a garden. Each of the plants has been treated with some amount of pesticide. After each day, if any plant has more pesticide than the plant on its left, being weaker than the left one, it dies.

  3. Determine the number of days after which no plant dies, i.e. the time after which there is no plant with more pesticide content than the plant to its left. Example p = [ 3, 6, 2, 7, 5 ] // pesticide levels Use a 1-indexed array.

  4. Feb 11, 2016 · HackerRank 'Poisonous Plants' Solution – Martin Kysel – Coding Challenges and More. Martin Kysel · February 11, 2016. coding-challenge hackerrank python. Short Problem Definition: There are NN plants in a garden. Each of these plants has been added with some amount of pesticide.

  5. Aug 3, 2015 · Problem Statement. There are N plants in a garden. Each of these plants has been added with some amount of pesticide. After each day, if any plant has more pesticide than the plant at its left, being weaker than the left one, it dies. You are given the initial values of the pesticide in each plant.

  6. Find the number of days after which all the plants die, given that a plant's pesticide value is greater than the one to it's left.

  7. ⭐️ Content Description ⭐️In this video, I have explained on how to solve poisonous plants using stacks in python. This hackerrank problem is a part of Proble...

  8. My HackerRank solutions. Contribute to charles-wangkai/hackerrank development by creating an account on GitHub.

  9. A very good starting point is to read on "the stock span problem", understanding the solution to this problem gives >80% of the solution I have here. A lot of discussions mentioned about finding the potential killer of each plant by using stack, scanning from right to left.

  10. Jul 20, 2023 · The Solution: def poisonousPlants(plants): days = 0 stack = [] for plant in plants: days_to_die = 1 # Check if the current plant has more pesticide than the plant on its left while stack and...

  1. People also search for