Skip to content

Instantly share code, notes, and snippets.

View moraispgsi's full-sized avatar
🏠
Working from home

Ricardo Morais moraispgsi

🏠
Working from home
  • elecctro.com
  • Setúbal, Portugal
View GitHub Profile
if the keypair is in PEM extension, open PuTTY Gen and load the PEM file, then press 'save private key' to save the
private key as a PPK file.
# SSH with Putty:
In Session, add the Host name and the port.
In Connection > SSH > Auth, add the PPK file in the 'Private key file for authentication' box.
In Connection > Data, add the user for the ssh connection(auto-login username).
//Default means that it will take the full namespace of the object
const defaultValue = '';
const keys = {
title: defaultValue,
severity: {
title: defaultValue,
domain: {
information: defaultValue,
@moraispgsi
moraispgsi / sliding-window.md
Last active February 7, 2021 15:58
Leet code - Sliding window

Static size sliding window:

What can be achieved:

  • We can iterate over all contiguous subsets of elements with a given size of a given sequence of elements with a good time complexity scalability.

// todo

Dynamic size sliding window:

@moraispgsi
moraispgsi / quick-select.md
Last active February 28, 2021 15:40
Quick select

Problem - Find the kth smallest/largest number in an unsorted array with n element.

Explanation: https://www.youtube.com/watch?v=hGK_5n81drs&ab_channel=BackToBackSWE

Quick select approach: The way that this is done is by using a form of quick sort. It work by a way of partitioning the array into parts.

Lets say we want to find the kth largest number in an array. If the array was sorted we would know what the index of this number would be, it would be (n - k). Since the array isn't sorted we need to find element for the index (n - k).

Now, to find the element we need to implement quick select. Quick select work like this (for finding the largest K):

  • First we break the algorithm down to a partition and a selection function.