We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6da4bdd commit 70686f1Copy full SHA for 70686f1
61-70/67. Add Binary.js
@@ -0,0 +1,4 @@
1
+var addBinary = function(a, b) {
2
+ let sum = BigInt(`0b${a}`) + BigInt(`0b${b}`);
3
+ return sum.toString(2);
4
+};
61-70/68. Text Justification.js
@@ -0,0 +1,25 @@
+var fullJustify = function(words, maxWidth) {
+ let [line,spaces,addSpace,minSpaces] = [0,0,0,""]
+ for (let res = [[]], i = 0, letters = 0; i <= words.length; letters += words[i++].length) {
+ let row = res[res.length - 1];
5
+ let len = row.length
6
+ if (i == words.length || len && letters + len + words[i].length > maxWidth) {
7
+ if (len == 1 || i == words.length) {
8
+ res[res.length - 1] = row.join(' ') + ' '.repeat(maxWidth - letters - len + 1);
9
+ if (i === words.length) return res;
10
+ } else {
11
+ line = row[0];
12
+ spaces = maxWidth - letters;
13
+ minSpaces = ' '.repeat(Math.floor(spaces / (len- 1)));
14
+ addSpace = spaces % (len - 1);
15
+ for (let w = 1; w < len; w++) {
16
+ line += minSpaces + (w <= addSpace ? ' ' : '') + row[w];
17
+ }
18
+ res[res.length - 1] = line;
19
20
+ res.push([]);
21
+ letters = 0;
22
23
+ res[res.length - 1].push(words[i]);
24
25
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
0 commit comments