3983 Minimum Operations To Equalize Binary String
Minimum Operations to Equalize Binary String You are given a binary string s, and an integer k. In one operation, you must choose exactly k different indices and flip each ‘0’ to ‘1’ and each ‘1...
Minimum Operations to Equalize Binary String You are given a binary string s, and an integer k. In one operation, you must choose exactly k different indices and flip each ‘0’ to ‘1’ and each ‘1...
Number of Steps to Reduce a Number in Binary Representation to One Given the binary representation of an integer as a string s, return the number of steps to reduce it to *1 under the following r...
Sort Integers by The Number of 1 Bits You are given an integer array arr. Sort the integers in the array in ascending order by the number of 1’s in their binary representation and in case of two ...
Sum of Root To Leaf Binary Numbers You are given the root of a binary tree where each node has a value 0 or 1. Each root-to-leaf path represents a binary number starting with the most significant...
Prime Number of Set Bits in Binary Representation Given two integers left and right, return the count of numbers in the inclusive range *[left, right] having a prime number of set bits in their b...
Special Binary String Special binary strings are binary strings with the following two properties: The number of 0's is equal to the number of 1's. Every prefix of the binary string has at least...
Binary Number with Alternating Bits Given a positive integer, check whether it has alternating bits: namely, if two adjacent bits will always have different values. Example 1: **Input:** n ...
Count Binary Substrings Given a binary string s, return the number of non-empty substrings that have the same number of 0’s and 1’s, and all the 0’s and all the 1’s in these substrings are groupe...
Binary Watch A binary watch has 4 LEDs on the top to represent the hours (0-11), and 6 LEDs on the bottom to represent the minutes (0-59). Each LED represents a zero or one, with the least signif...
Add Binary Given two binary strings a and b, return their sum as a binary string. Example 1: **Input:** a = "11", b = "1" **Output:** "100" Example 2: **Input:** a = "1010", b = "1011" *...