Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Chapter 1

Vagrant presentation

Introduction to Amateur Radio

To prepare for the amateur radio exam, I used the "Le Radioamateur" 4th edition book.

Book «Le Radioamateur» (4th edition)

Le Radioamateur (4th edition)

Exercises

Here a list of exercices:

Exercise 1:

schéma1

Exercise 2:

Exercise 1

Here is a circuit to simplify.

schéma1

We can first simplify R2,R3,R4.

We can simplify this part of the scheme, let's do it.

schéma1 $$ \mathbf{ R_{eq} = \frac{R_2 (R_3 + R_4)}{R_2 + R_3 + R_4} = 1.1~\Omega } $$

schéma1

And then easy peasy

schéma1

Cookie Cutter

Here is an example of a cookieCutter project.

It is a pretty good tool to create template. !TODO

Lazygit

Presentation of LeetCode

Arrays and hashing

Exercises

217. Contains Duplicate

{{#tabs }} {{#tab name="C++" }}

using namespace std;
#include <unordered_set>
#include <vector>
class Solution {
public:
  bool containsDuplicate(vector<int> &nums) {
    unordered_set<int> seen;
    for (int i : nums) {
      if (seen.count(i)) {
        return true;
      }
      seen.insert(i);
    }
    return false;
  }
};

{{#endtab }} {{#tab name="c" }} !TODO {{#endtab }} {{#tab name="python" }}

class Solution(object):
    def containsDuplicate(self, nums):
        """
        :type nums: List[int]
        :rtype: bool
        """
        return(len(set(nums)) != len(nums))

-> Castt a set on list is O(n) and a len is O(1) and len(nums) is O(n) in time -> In memory it doesn't allocate anything. {{#endtab }} {{#endtabs }}

242. Valid Anagram

{{#tabs }} {{#tab name="C++" }}

#include <string>
#include <vector>
using namespace std;
class Solution {
public:
  bool isAnagram(string s, string t) {
    vector<int> freq(26, 0);
    for (char ch : s) {
      freq[ch - 'a']++;
    }
    for (char ch : t) {
      freq[ch - 'a']--;
    }
    for (int count : freq) {
      if (count != 0)
        return false;
    }
    return true;
  }
};

{{#endtab }} {{#tab name="c" }} !TODO {{#endtab }} {{#tab name="python" }}

class Solution:
    def isAnagram(self, s: str, t: str) -> bool:
        return(''.join(sorted(s))=="".join(sorted(t)))

This is far better:

class Solution:
    def isAnagram(self, s: str, t: str) -> bool:
        list_count = [0]*26
        for ch in s:
            list_count[ord(ch)-ord("a")]+=1
        for ch in t:
            list_count[ord(ch)-ord("a")]-=1
        return all(val==0 for val in list_count)

-> Easy solution but not efficient at all. {{#endtab }} {{#endtabs }}