This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getHorizontalInfoThroughPixels (ctx) { | |
const canvas = ctx.canvas | |
const width = canvas.width | |
const height = canvas.height | |
const data = ctx.getImageData(0, 0, width, height).data | |
let firstCol = 0 | |
let lastCol = 0 | |
let isFindLastCol = false | |
let isFindFirstCol = false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 实现思路: | |
* 1. 创建一个栈 | |
* 2. 遍历字符串 | |
* - 栈为空时,若 item 为左括号则入栈,右括号则 return false | |
* - item 为左括号就入栈 | |
* - item 为右括号时,stack 就 pop 出左括号,判断两者是否匹配 | |
* - 若匹配则继续 | |
* - 若不匹配则 return false | |
*/ |