shiki0331’s blog

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

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

C++でLeetCodeの「Longest Substring Without Repeating Characters」問題を解く

Problem https://leetcode.com/problems/longest-substring-without-repeating-characters/ Answer class Solution { public: int lengthOfLongestSubstring(std::string s) { std::unordered_map<char, int> map; int maxLength = 0; int left = 0; for (int right = 0</char,>…

C++でLeetCodeの「Add two numbers」問題を解く

Problem https://leetcode.com/problems/add-two-numbers/description/ Answer /** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode() : val(0), next(nullptr) {} * ListNode(int x) : val(x), next(nu…

TypeScriptにおける Record 型の実装を理解する

TypeScriptのRecord型とは? まず、TypeScriptのRecord機能について説明します。 Record型の説明は以下のURLで確認できます: https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type Record型は、2つの型を受け入れることで、あ…

C++でLeetCodeの「Two Sum」問題を解く

## Problemhttps://leetcode.com/problems/two-sum/description/?envType=featured-list&envId=top-interview-questions ## Answer (Brute Force)```class Solution {public: vector<int> twoSum(vector<int>& nums, int target) { for (int i = 0; i < nums.size() - </int></int>…