Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions leetcode3/정진영/385. Mini Parser
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/**
* // This is the interface that allows for creating nested lists.
* // You should not implement it, or speculate about its implementation
* function NestedInteger() {
*
* Return true if this NestedInteger holds a single integer, rather than a nested list.
* @return {boolean}
* this.isInteger = function() {
* ...
* };
*
* Return the single integer that this NestedInteger holds, if it holds a single integer
* Return null if this NestedInteger holds a nested list
* @return {integer}
* this.getInteger = function() {
* ...
* };
*
* Set this NestedInteger to hold a single integer equal to value.
* @return {void}
* this.setInteger = function(value) {
* ...
* };
*
* Set this NestedInteger to hold a nested list and adds a nested integer elem to it.
* @return {void}
* this.add = function(elem) {
* ...
* };
*
* Return the nested list that this NestedInteger holds, if it holds a nested list
* Return null if this NestedInteger holds a single integer
* @return {NestedInteger[]}
* this.getList = function() {
* ...
* };
* };
*/
/**
* @param {string} s
* @return {NestedInteger}
*/
var deserialize = function(s) {
const stack = [];
let num = "";

for (let i = 0; i<s.length; i++){
const ch = s[i];
if (ch == '[')
}
};
27 changes: 27 additions & 0 deletions leetcode3/정진영/463. Island Perimeter
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/**
* @param {number[][]} grid
* @return {number}
*/
var islandPerimeter = function(grid) {
let count = 0;

for (let i = 0; i<grid.length; i++){
for (let j = 0; j<grid[0].length; j++){
// land 일 때
if (grid[i][j] == 1){
count += 4;

if (j>0 && grid[i][j-1] == 1){
count -= 1;
} if (i>0 && grid[i-1][j] == 1){
count -= 1;
} if (j<grid[0].length-1 && grid[i][j+1] == 1){
count -= 1;
} if (i<grid.length-1 && grid[i+1][j] == 1){
count -= 1;
}
}
}
}
return count;
};