Skip to content

Instantly share code, notes, and snippets.

View rootsec1's full-sized avatar
πŸ‘¨β€πŸ’»
AFK

Abhishek Murthy rootsec1

πŸ‘¨β€πŸ’»
AFK
View GitHub Profile
@rootsec1
rootsec1 / fibb.ts
Last active June 10, 2019 08:19
Check if number belongs to Fibonacci Sequence using Typescript
function checkIfNumberIsFibonacci(n:number):boolean {
let a:number = 0;
let b:number = 1;
for(let i:number=2; i<=n; i++) {
const c:number = a+b;
if(n===c || n===b || n===a) return true;
a=b;
b=c;
}
return false;