Open Zheaoli opened 1 year ago
#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 插件
/*
* @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 插件
2022-11-01