Skip to content

Commit ef965b7

Browse files
Merge pull request #2007 from CodingTestStudy2/황은지
[황은지] Day10
2 parents 610b5d1 + 57d89db commit ef965b7

2 files changed

Lines changed: 30 additions & 0 deletions

File tree

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/**
2+
* @param {character[][]} boxGrid
3+
* @return {character[][]}
4+
*/
5+
var rotateTheBox = function (boxGrid) {
6+
const output = Array.from({ length: boxGrid[0].length }, () =>
7+
Array(boxGrid.length),
8+
);
9+
};
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/**
2+
* @param {number[]} nums
3+
* @return {number[]}
4+
*/
5+
var minBitwiseArray = function(nums) {
6+
const arr=Array(1000).fill(-1);
7+
const max=Math.max(...nums);
8+
9+
for(let num=0;num<=max;num++){
10+
const afterOr=num|(num+1);
11+
if(arr[afterOr]===-1) arr[afterOr]=num;
12+
}
13+
14+
const result=Array(nums.length);
15+
for(let i=0;i<nums.length;i++){
16+
result[i]=arr[nums[i]]
17+
}
18+
19+
return result;
20+
21+
};

0 commit comments

Comments
 (0)