HZFE / vscode-hzfe-algorithms

HZFE 刷题用插件
0 stars 0 forks source link

2022-07-30 #2

Open gongpeione opened 2 years ago

gongpeione commented 2 years ago
/*
 * @lc app=leetcode id=67 lang=javascript
 *
 * [67] Add Binary
 */

// @lc code=start
/**
 * @param {string} a
 * @param {string} b
 * @return {string}
 */
var addBinary = function(a, b) {

};
// @lc code=end

Nickname: Geeku From vscode-hzfe-algorithms

gongpeione commented 2 years ago
/*
 * @lc app=leetcode id=58 lang=javascript
 *
 * [58] Length of Last Word
 */

// @lc code=start
/**
 * @param {string} s
 * @return {number}
 */
var lengthOfLastWord = function(s) {

};
// @lc code=end

Nickname: G From vscode-hzfe-algorithms

gongpeione commented 2 years ago
/*
 * @lc app=leetcode id=58 lang=javascript
 *
 * [58] Length of Last Word
 */

// @lc code=start
/**
 * @param {string} s
 * @return {number}
 */
var lengthOfLastWord = function(s) {

};
// @lc code=end

Nickname: G From vscode-hzfe-algorithms

gongpeione commented 2 years ago

58 [58] Length of Last Word,Length of Last Word

/*
 * @lc app=leetcode id=58 lang=javascript
 *
 * [58] Length of Last Word
 */

// @lc code=start
/**
 * @param {string} s
 * @return {number}
 */
var lengthOfLastWord = function(s) {

};
// @lc code=end

Nickname: G From vscode-hzfe-algorithms

gongpeione commented 2 years ago

58 Length of Last Word

/*
 * @lc app=leetcode id=58 lang=javascript
 *
 * [58] Length of Last Word
 */

// @lc code=start
/**
 * @param {string} s
 * @return {number}
 */
var lengthOfLastWord = function(s) {

};
// @lc code=end

Nickname: G From vscode-hzfe-algorithms

gongpeione commented 2 years ago

Leetcode: 58 Length of Last Word

/*
 * @lc app=leetcode id=58 lang=javascript
 *
 * [58] Length of Last Word
 */

// @lc code=start
/**
 * @param {string} s
 * @return {number}
 */
var lengthOfLastWord = function(s) {

};
// @lc code=end

Nickname: G From vscode-hzfe-algorithms

gongpeione commented 2 years ago

58 Length of Last Word

/*
 * @lc app=leetcode id=58 lang=javascript
 *
 * [58] Length of Last Word
 */

// @lc code=start
/**
 * @param {string} s
 * @return {number}
 */
var lengthOfLastWord = function(s) {

};
// @lc code=end

Nickname: G From vscode-hzfe-algorithms

gongpeione commented 2 years ago

两数之和

/*
 * @lc app=leetcode.cn id=1 lang=javascript
 *
 * [1] 两数之和
 */

// @lc code=start
/**
 * @param {number[]} nums
 * @param {number} target
 * @return {number[]}
 */
var twoSum = function(nums, target) {

};
// @lc code=end

Nickname: G From vscode-hzfe-algorithms

gongpeione commented 2 years ago
/*
 * @lc app=leetcode.cn id=1 lang=javascript
 *
 * [1] 两数之和
 */

// @lc code=start
/**
 * @param {number[]} nums
 * @param {number} target
 * @return {number[]}
 */
var twoSum = function(nums, target) {

};
// @lc code=end

Nickname: G From vscode-hzfe-algorithms

gongpeione commented 2 years ago

1 Two Sum

/*
 * @lc app=leetcode id=1 lang=javascript
 *
 * [1] Two Sum
 */

// @lc code=start
/**
 * @param {number[]} nums
 * @param {number} target
 * @return {number[]}
 */
var twoSum = function(nums, target) {
    const m = {};
    for (let i = 0; i < nums.length; i++) {
        const num = nums[i];
        if (m[target - num] !== undefined) {
            return [m[target - num], i];
        }
        if (m[num] === undefined) {
            m[num] = i;
        }
    }
};
// @lc code=end

Nickname: G From vscode-hzfe-algorithms