do-something-right icon indicating copy to clipboard operation
do-something-right copied to clipboard

2022-11-01

Open Zheaoli opened this issue 3 years ago • 2 comments

2022-11-01

Zheaoli avatar Oct 31 '22 16:10 Zheaoli

#include <iostream>
#include <vector>
using namespace std;
/*
 * @lc app=leetcode.cn id=1662 lang=cpp
 *
 * [1662] 检查两个字符串数组是否相等
 */

// @lc code=start
class Solution
{
public:
    bool arrayStringsAreEqual(vector<string> &word1, vector<string> &word2)
    {
        auto join = [](vector<string> &word) -> string
        {
            string res = "";
            for (auto &&w : word)
            {
                res += w;
            }
            return res;
        };
        return join(word1) == join(word2);
    }
};
// @lc code=end


微信id: 而我撑伞 来自 vscode 插件

dreamhunter2333 avatar Nov 01 '22 13:11 dreamhunter2333

/*
 * @lc app=leetcode id=168 lang=typescript
 *
 * [168] Excel Sheet Column Title
 */

// @lc code=start
function convertToTitle(columnNumber: number): string {
    const ans = [] as string[];
    const startNum = 'A'.charCodeAt(0);

    while (columnNumber) {
        // because A is start from 1, not 0
        const num = (columnNumber - 1) % 26;
        ans.unshift(
            String.fromCharCode(startNum + num)
        );

        columnNumber = ~~((columnNumber - 1) / 26);
    }

    return ans.join('');
};
// @lc code=end



微信id: 弘树 来自 vscode 插件

gongpeione avatar Nov 01 '22 15:11 gongpeione