shiki0331’s blog

Web Developer. TypeScript / React.js を中心に学んでいます。 ブログ内容で間違っている箇所などありましたら、ご指摘していただけると助かります。

2023-07-01から1ヶ月間の記事一覧

Solving the 'Zigzag Conversion' on LeetCode with C++

問題 https://leetcode.com/problems/zigzag-conversion/ 答え class Solution { public: string convert(string s, int numRows) { if(numRows == 1) { return s; } vector<string> rows(min(numRows, int(s.size()))); int currentRow = 0; bool goingDown = false</string>…

C++でLeetCodeの「Longest Palindromic Substring」問題を解く

Problem https://leetcode.com/problems/longest-palindromic-substring/ Answer O(N3) class Solution { private: bool check(string &subString, int subStringSize){ int i = 0; while(i < j) { if(subString[i] != subString[j]) { return false; } i++;…