An Interest In:
Web News this Week
- April 24, 2024
- April 23, 2024
- April 22, 2024
- April 21, 2024
- April 20, 2024
- April 19, 2024
- April 18, 2024
February 13, 2022 04:19 am GMT
Original Link: https://dev.to/dreamyplayer/problem-solving-for-developers-javascript-311n
Problem Solving for Developers - Javascript
Hey, Everyone!
I'm Dreamy! Today's problem [easy]
Have a bit of coding yourself and see what kind of solution you came up with, and comment down your best solution.
/** * Given an array of size N consisting of only 0's and 1's. * The array is sorted in such a manner that all the 1's are placed first * and then they are followed by all the 0's. * Find the count of all the 0's. * Example 1: * Input: * N = 12 * array = [1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0] * Output: 3 * Explanation: There are 3 0's in the given array. * Example 2: * Input: * N = 5 * array = [0, 0, 0, 0, 0] * Output: 5 * Explanation: There are 5 0's in the array. */
Original Link: https://dev.to/dreamyplayer/problem-solving-for-developers-javascript-311n
Share this article:
Tweet
View Full Article
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To