Skip to content

Instantly share code, notes, and snippets.

View jtn-ms's full-sized avatar
🏘️
working from home

Brian G. jtn-ms

🏘️
working from home
  • remote
View GitHub Profile
from __future__ import print_function
import numpy as np
from xlwings import Workbook, Range
#Deep excel not included please find it here: http://www.deepexcel.net/
def run_test_data():
with open('test.csv','rt') as f:
with open('result.csv','wt') as r:
@jtn-ms
jtn-ms / FILECOIN MINING SOLUTION.md
Last active February 8, 2022 13:07
Product/Service Description For potential filecoin mining providers

In cryptocurrency world, major earning models are Cryptocurrency Mining, ICO, crypto trading(Exchange/DEX, DeFi, NFT). Here, our topic is mining - especially filecoin(lotus).

A Crypto Mining depends on the consenus algorithm of the blockchain. In PoW blockchains like bitcoin, more computing power, more rewarded.In PoS blockchains like ethereum-2.0 & cosmos, more stakes, more rewards gained. In filecoin, of which the consensus is PoRep+PoST, more storage pledged, more rewards. For lotus mining, anyone can buy storage and computing machines for it from the market. The key part that every mining provider concerns is pledging/sealing speed because miners are finally rewarded according to the portion of their pledged storage over the whole network pledged storage. So, higher sealing algorithm means almost everything to them. It can reduce the number of computers to be purchased or It also ensure that you can win in the competition over growth of pleding power with other miners. There are offical version

@jtn-ms
jtn-ms / breakingRecords.ts
Created June 24, 2022 07:20
hackerrank changes - breaking records
function breakingRecords(scores: number[]): number[] {
// Write your code here
let most = scores[0];
let least = most;
let cnt_m = 0;
let cnt_l = 0;
for (let i=1; i<scores.length; i++){
if (scores[i] > most) {
most = scores[i];
cnt_m++;
@jtn-ms
jtn-ms / divisibleSumPairs.ts
Created June 24, 2022 07:36
hackerrank challenge - divisble pairs
function divisibleSumPairs(n: number, k: number, ar: number[]): number {
// Write your code here
let cnt = 0
for (let i=0;i<n-1;i++){
for (let j=i+1;j<n;j++){
if ((ar[i]+ar[j])%k == 0){
console.log(ar[i],ar[j])
cnt++
}
}
function matchingStrings(strings: string[], queries: string[]): number[] {
// Write your code here
let ret:number[] = [];
for (let i=0;i<queries.length;i++){
let cnt = 0;
for(let j=0;j<strings.length;j++){
if (strings[j] === queries[i]){
cnt++
}
}
@jtn-ms
jtn-ms / findMedian.ts
Created June 24, 2022 07:55
hackerrank mock test
function findMedian(arr: number[]): number {
// Write your code here
var sorted: number[] = arr.sort((n1,n2) => n1 - n2);
let median = arr.length % 2 == 0 ? arr.length/2 : (arr.length-1)/2
return sorted[median]
}
@jtn-ms
jtn-ms / pangrams.ts
Created June 24, 2022 08:11
hackerrank - pangram
function pangrams(str: string): string {
// Write your code here
let lstr = str.toLowerCase()
let cmap = new Map<string, number>();
for (let i = 0; i < str.length; i++){
cmap.set(lstr[i],1)
}
const alphabet = "abcdefghijklmnopqrstuvwxyz"
for (let j =0; j<alphabet.length;j++){
if (!cmap.has(alphabet[j])) {
def flippingMatrix(matrix):
l=[]
n=len(matrix[0])//2
for x in range(n):
for y in range(n):
l.append(max(matrix[x][y],matrix[x][2*n-y-1],matrix[2*n-x-1][y],matrix[2*n-x-1][2*n-y-1]))
return sum(l)
@jtn-ms
jtn-ms / betweenTwoSets.py
Created June 24, 2022 08:38
hackerrank - Between Two Sets
def check_a(number, a):
for el in a:
if number % el != 0:
return False
return True
def check_b(number, b):
for el in b:
if el % number != 0:
return False
@jtn-ms
jtn-ms / PermuteTwoArray.py
Created June 24, 2022 08:58
hackerranker - permute 2 arrays
def twoArrays(k, A, B):
# Write your code here
# if (min(A) + max(B) < k) or (min(B) + max(A) < k):
# return "NO"
# return "YES"
A.sort()
B.sort()
B = B[::-1]
for a,b in zip(A,B):