Evgenii Legotckoi
Маусым 13, 2022, 3:15 Т.Қ.

C++Leet Code Solutions - 003 - Қайталанатын таңбаларсыз ең ұзын ішкі жол

cpp, LeetCode, C++, C++17, string

Решение "Longest Substring Without Repeating Characters" на Leet Code


  1. class Solution {
  2. public:
  3. int lengthOfLongestSubstring(string s) {
  4. string candidate_str = "";
  5. string checking_str = "";
  6. size_t position = std::string::npos;
  7. for (auto& ch : s)
  8. {
  9. position = checking_str.find(ch);
  10. if (position
Оқы
Evgenii Legotckoi
Маусым 13, 2022, 2:13 Т.Қ.

C++Leed Code Solutions - 002 - Екі санды қосу

LeetCode, cpp, C++

Решение "Add Two Numbers" на Leet Code


  1. /**
  2. * Definition for singly-linked list.
  3. * struct ListNode {
  4. * int val;
  5. * ListNode *next;
  6. * ListNode() : val(0), next(nullptr) {}
  7. * ListNode(int x) : val(x), next(nullptr) {}
  8. * ListNode(int x, ListNode …
Оқы
Evgenii Legotckoi
Маусым 13, 2022, 1:58 Т.Қ.

C++Leet Code Solutions - 001 - Екі сом

cpp, LeetCode, C++

Решение Two Sum на Leet Code


Обычное решение

  1. class Solution {
  2. public:
  3. vector<int> twoSum(vector<int>& nums, int target) {
  4. for (int i = 0; i < nums.size(); ++i)
  5. {
  6. for (int j = i + 1; j < nums.size(); ++j)
  7. {
Оқы