You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: lcci/05.01.Insert Into Bits/README_EN.md
+1-19
Original file line number
Diff line number
Diff line change
@@ -5,37 +5,21 @@
5
5
## Description
6
6
7
7
<p>You are given two 32-bit numbers, N and M, and two bit positions, i and j. Write a method to insert M into N such that M starts at bit j and ends at bit i. You can assume that the bits j through i have enough space to fit all of M. That is, if M = 10011, you can assume that there are at least 5 bits between j and i. You would not, for example, have j = 3 and i = 2, because M could not fully fit between bit 3 and bit 2.</p>
8
-
9
8
<p><strong>Example1:</strong></p>
10
-
11
9
<pre>
12
10
13
-
14
-
15
11
<strong> Input</strong>: N = 10000000000, M = 10011, i = 2, j = 6
16
12
17
-
18
-
19
13
<strong> Output</strong>: N = 10001001100
20
14
21
-
22
-
23
15
</pre>
24
-
25
16
<p><strong>Example2:</strong></p>
26
-
27
17
<pre>
28
18
29
-
30
-
31
-
<strong> Input</strong>: N = 0, M = 11111, i = 0, j = 4
32
-
33
-
19
+
<strong> Input</strong>: N = 0, M = 11111, i = 0, j = 4
0 commit comments