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 i…


This content originally appeared on DEV Community and was authored by Dreamy Developer

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.
 */


This content originally appeared on DEV Community and was authored by Dreamy Developer


Print Share Comment Cite Upload Translate Updates
APA

Dreamy Developer | Sciencx (2022-02-13T04:19:54+00:00) Problem Solving for Developers – Javascript. Retrieved from https://www.scien.cx/2022/02/13/problem-solving-for-developers-javascript/

MLA
" » Problem Solving for Developers – Javascript." Dreamy Developer | Sciencx - Sunday February 13, 2022, https://www.scien.cx/2022/02/13/problem-solving-for-developers-javascript/
HARVARD
Dreamy Developer | Sciencx Sunday February 13, 2022 » Problem Solving for Developers – Javascript., viewed ,<https://www.scien.cx/2022/02/13/problem-solving-for-developers-javascript/>
VANCOUVER
Dreamy Developer | Sciencx - » Problem Solving for Developers – Javascript. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2022/02/13/problem-solving-for-developers-javascript/
CHICAGO
" » Problem Solving for Developers – Javascript." Dreamy Developer | Sciencx - Accessed . https://www.scien.cx/2022/02/13/problem-solving-for-developers-javascript/
IEEE
" » Problem Solving for Developers – Javascript." Dreamy Developer | Sciencx [Online]. Available: https://www.scien.cx/2022/02/13/problem-solving-for-developers-javascript/. [Accessed: ]
rf:citation
» Problem Solving for Developers – Javascript | Dreamy Developer | Sciencx | https://www.scien.cx/2022/02/13/problem-solving-for-developers-javascript/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.