Skip to content

Instantly share code, notes, and snippets.

View AmosAidoo's full-sized avatar
🎯
Focusing

Amos Aidoo AmosAidoo

🎯
Focusing
View GitHub Profile
@AmosAidoo
AmosAidoo / List.md
Created January 27, 2019 02:13 — forked from msurguy/List.md
List of open source projects made with Laravel

Other people's projects:

My projects (tutorials are on my blog at http://maxoffsky.com):

@AmosAidoo
AmosAidoo / FacebookQuestion.java
Created October 30, 2019 19:17
Some random problem I found in a WhatsApp group
public class FacebookProblem {
public static void main(String[] args) {
// TODO code application logic here
int A[][] = {
{5, 4, 4},
{4, 3, 4},
{3, 2, 4},
{2, 2, 2},
{3, 3, 4},
@AmosAidoo
AmosAidoo / hdtn.py
Created November 24, 2019 19:03
Highly Divisible Triangle Number
import math
#Variables to store n and our final answer
n, ans = 1, -1
#Variable to store the highest number of divisors so far
div = 0
while True:
#Compute the n-th triangle number
void _empty(int* Sk, int& T, int n) {
int groupCount = 0;
do {
//m will be the top-most item on the stack and on subsequent groups
int m = Sk[T];
//Remove all m elements from the stack
T = T - m - 1;
groupCount += 1;
} while (T > 0);
#include <iostream>
using namespace std;
void push(int* Sk, int& T, int n); //A helper function
void _empty(int* Sk, int& T, int n); //The answer
int main() {
int n, T;
char c;
bool quit = false;
sum = 0 #Store the sum of the numbers
sum_squares = 0 #Store the squares of the sum
for i in range(1, 101):
sum_squares = sum_squares + (i ** 2) #Compute the squares of the sum
sum = sum + i #Compute the sum
ans = sum**2 - sum_squares #Do the subtraction
print(ans) #print the answer
#Function to caluculate the value of a string
#Parameter: string, a string from the file
#Parameter: position, position of string in the file
def calculate_value(string, position):
worth = 0
for c in string:
worth = worth + (ord(c) - 64)
return worth * position
#Variable to keep names
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cmath>
using namespace std;
//Function prototypes
#include <bits/stdc++.h>
using namespace std;
int main() {
int n,s,i,j,b,t;
cin >> n;
int arr[n][n]{0};
s = n*n;
t=n;
b = 0;
#include <iostream>
#include <cmath>
using namespace std;
class Polynomial {
double a,b,c;
public:
Polynomial() {} //Default constructor
Polynomial(const Polynomial& poly_old); //Copy constructor
Polynomial(double a, double b, double c) {