From ea9512ad2492494cb717860dfac8ca5f278d3882 Mon Sep 17 00:00:00 2001 From: Andrew Schneider Date: Fri, 31 May 2024 20:25:45 -0400 Subject: more fix README formatting --- challenge-271/atschneid/README.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/challenge-271/atschneid/README.md b/challenge-271/atschneid/README.md index a590aed159..e0a5c17bd2 100644 --- a/challenge-271/atschneid/README.md +++ b/challenge-271/atschneid/README.md @@ -15,22 +15,22 @@ Now onto the code. ## Task 1: Maximum Ones > You are given a m x n binary matrix.
-
+>
> Write a script to return the row number containing maximum ones, in case of more than one rows then return smallest row number.
-
+>
> Example 1
> Input: $matrix = [ [0, 1],
> [1, 0],
> ]
> Output: 1
-
+>
> Row 1 and Row 2 have the same number of ones, so return row 1.
> Example 2
> Input: $matrix = [ [0, 0, 0],
> [1, 0, 1],
> ]
> Output: 2
-
+>
> Row 2 has the maximum ones, so return row 2.
> Example 3
> Input: $matrix = [ [0, 0],
@@ -38,7 +38,7 @@ Now onto the code. > [0, 0],
> ]
> Output: 2
-
+>
> Row 2 have the maximum ones, so return row 2.
One thing that surprised me here, we want the 1 indexed row. For example, I would have expected the first solution to be 0, the zeroth row. But, I'll solve the problem I'm given. @@ -65,13 +65,13 @@ And that's about it. I return that `$idx` value, then increment it (0 to 1 index ## Task 2: Sort by 1 bits > You are give an array of integers, @ints.A
-
+>
> Write a script to sort the integers in ascending order by the number of 1 bits in their binary representation. In case more than one integers have the same number of 1 bits then sort them in ascending order.
-
+>
> Example 1
> Input: @ints = (0, 1, 2, 3, 4, 5, 6, 7, 8)
> Output: (0, 1, 2, 4, 8, 3, 5, 6, 7)
-
+>
> 0 = 0 one bits
> 1 = 1 one bits
> 2 = 1 one bits
@@ -84,7 +84,7 @@ And that's about it. I return that `$idx` value, then increment it (0 to 1 index > Example 2
> Input: @ints = (1024, 512, 256, 128, 64)
> Output: (64, 128, 256, 512, 1024)
-
+>
> All integers in the given array have one 1-bits, so just sort them in ascending order.
At first I thought I was going to end up reusing some pieces of my solution to Task 1 for this, but it turned out to be just different enough that I didn't think it was worth it. -- cgit