Project-Euler-025

### Problem

The Fibonacci sequence is defined by the recurrence relation:

$$Fn = F{n-1} + F_{n-2} \text{ where } F_1 = 1 \text{ and } F_2 = 1$$

Hence the first 12 terms will be:

$$\begin{split} F_1 &= 1 \ F_2 &= 1 \ F_3 &= 2 \ F_4 &= 3 \ F_5 &= 5 \ F_6 &= 8 \ F_7 &= 13 \ F_8 &= 21 \ F9 &= 34 \ F {10} &= 55 \ F{11} &= 89 \ F {12} &= 144 \end{split}$$

The 12th term, $F_{12}$, is the first term to contain three digits.

What is the first term in the Fibonacci sequence to contain 1000 digits?

Perceptron with Margin

It is a simple simulation of Perceptron Algorithm using p5.js.

You can insert the data-points belonging to two classes as well as change the Learning Rate and Threshold(or Margin) on canvas at runtime using Sliders and simulate how the Linear Seperater converges to classify the given data.

You can interact on web browsers by simply click the index.html file on your browser.

User can insert the data-points belonging to two classes as well as change the Learning Rate and Threshold or Margin on canvas at runtime using Sliders and simulate how the Linear Separater converges to classify the given data. sketch.js contains the core logic for the simulation.

LeetCode Notes 025

### Find All Numbers Disappeared in an Array

Given an array of integers where $1 ≤ a[i] ≤ n$ (n = size of array), some elements appear twice and others appear once.

Find all the elements of $[1, n]$ inclusive that do not appear in this array.

Could you do it without extra space and in $O(n)$ runtime? You may assume the returned list does not count as extra space.

Project-Euler-024

### Problem

A permutation is an ordered arrangement of objects. For example, 3124 is one possible permutation of the digits 1, 2, 3 and 4. If all of the permutations are listed numerically or alphabetically, we call it lexicographic order. The lexicographic permutations of 0, 1 and 2 are:

$$012, 021, 102, 120, 201, 210$$

What is the millionth lexicographic permutation of the digits 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9?

LeetCode Notes 024

### Excel Sheet Column Number

Related to question Excel Sheet Column Title

Given a column title as appear in an Excel sheet, return its corresponding column number.

For example:

LeetCode Notes 023

### Diagonal Traverse

Given a matrix of M x N elements (M rows, N columns), return all elements of the matrix in diagonal order as shown in the below image.

Example:

Explanation:

Note:

1. The total number of elements of the given matrix will not exceed 10,000.