File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change 1165
1165
1253|[ Reconstruct a 2-Row Binary Matrix] ( ./solutions/1253-reconstruct-a-2-row-binary-matrix.js ) |Medium|
1166
1166
1254|[ Number of Closed Islands] ( ./solutions/1254-number-of-closed-islands.js ) |Medium|
1167
1167
1255|[ Maximum Score Words Formed by Letters] ( ./solutions/1255-maximum-score-words-formed-by-letters.js ) |Hard|
1168
+ 1256|[ Encode Number] ( ./solutions/1256-encode-number.js ) |Medium|
1168
1169
1260|[ Shift 2D Grid] ( ./solutions/1260-shift-2d-grid.js ) |Easy|
1169
1170
1261|[ Find Elements in a Contaminated Binary Tree] ( ./solutions/1261-find-elements-in-a-contaminated-binary-tree.js ) |Medium|
1170
1171
1262|[ Greatest Sum Divisible by Three] ( ./solutions/1262-greatest-sum-divisible-by-three.js ) |Medium|
Original file line number Diff line number Diff line change
1
+ /**
2
+ * 1256. Encode Number
3
+ * https://leetcode.com/problems/encode-number/
4
+ * Difficulty: Medium
5
+ *
6
+ * Given a non-negative integer num, Return its encoding string.
7
+ *
8
+ * The encoding is done by converting the integer to a string using a secret function that
9
+ * you should deduce from the following table:
10
+ */
11
+
12
+ /**
13
+ * @param {number } num
14
+ * @return {string }
15
+ */
16
+ var encode = function ( num ) {
17
+ return ( num + 1 ) . toString ( 2 ) . slice ( 1 ) ;
18
+ } ;
You can’t perform that action at this time.
0 commit comments