Skip to content

Commit 19b279c

Browse files
refactor 1356
1 parent 99d00b6 commit 19b279c

File tree

1 file changed

+0
-38
lines changed

1 file changed

+0
-38
lines changed

src/main/java/com/fishercoder/solutions/_1356.java

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -6,44 +6,6 @@
66
import java.util.List;
77
import java.util.Map;
88

9-
/**
10-
* 1356. Sort Integers by The Number of 1 Bits
11-
*
12-
* Given an integer array arr. You have to sort the integers in the array in ascending order by the number of 1's in
13-
* their binary representation and in case of two or more integers have the same number of 1's you have to sort them in ascending order.
14-
*
15-
* Return the sorted array.
16-
*
17-
* Example 1:
18-
* Input: arr = [0,1,2,3,4,5,6,7,8]
19-
* Output: [0,1,2,4,8,3,5,6,7]
20-
* Explantion: [0] is the only integer with 0 bits.
21-
* [1,2,4,8] all have 1 bit.
22-
* [3,5,6] have 2 bits.
23-
* [7] has 3 bits.
24-
* The sorted array by bits is [0,1,2,4,8,3,5,6,7]
25-
*
26-
* Example 2:
27-
* Input: arr = [1024,512,256,128,64,32,16,8,4,2,1]
28-
* Output: [1,2,4,8,16,32,64,128,256,512,1024]
29-
* Explantion: All integers have 1 bit in the binary representation, you should just sort them in ascending order.
30-
*
31-
* Example 3:
32-
* Input: arr = [10000,10000]
33-
* Output: [10000,10000]
34-
*
35-
* Example 4:
36-
* Input: arr = [2,3,5,7,11,13,17,19]
37-
* Output: [2,3,5,17,7,11,13,19]
38-
*
39-
* Example 5:
40-
* Input: arr = [10,100,1000,10000]
41-
* Output: [10,100,10000,1000]
42-
*
43-
* Constraints:
44-
* 1 <= arr.length <= 500
45-
* 0 <= arr[i] <= 10^4
46-
* */
479
public class _1356 {
4810
public static class Solution1 {
4911
public int[] sortByBits(int[] arr) {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy