Skip to content

Instantly share code, notes, and snippets.

View thinkphp's full-sized avatar
💭
If I have seen further it is only by standing on the shoulders of giants. Newton

Adrian Statescu thinkphp

💭
If I have seen further it is only by standing on the shoulders of giants. Newton
View GitHub Profile
@thinkphp
thinkphp / triunghiul-pascal.cpp
Created March 28, 2026 08:44
triunghiul-pascal.cpp
#include <iostream>
#include <vector>
using namespace std;
//programare dinamica
class Solution {
public:
vector<vector<int>> generate(int numRows) {
@thinkphp
thinkphp / sortare prin insertie.cpp
Created March 28, 2026 08:13
sortare prin insertie.cpp
#include <iostream>
#include <vector>//template
//bubblesort, selection by minimum, insertion sort
//2 3 9 4 -1 23 4 54
//
using namespace std;
@thinkphp
thinkphp / isHappy.cpp
Created March 28, 2026 08:02
isHappy
#include <iostream>
using namespace std;
class Solution {
//n = 18
public:
@thinkphp
thinkphp / collatz.cpp
Created March 25, 2026 18:59
collatz algoritm
#include <iostream>
using namespace std;
int main(int argc, char const *argv[])
{
unsigned n;//input n natural
cin>>n;
@thinkphp
thinkphp / fibverif.c
Created March 25, 2026 18:46
Pbinfo fibverif.c
#include <stdio.h>
void fb() {
int n;
scanf("%d", &n);
int arr[ n ];
for(int i = 0; i < n; ++i) scanf("%d", &arr[i]);
@thinkphp
thinkphp / fibonacci.cpp
Created March 25, 2026 18:16
Fibonacci Pbinfo
#include <iostream>
using namespace std;
/*
Sirul lui Fibonacci:
0,1,1,2,3,5,8,13,21,34,....+infinit
*/
@thinkphp
thinkphp / sumseq.c
Created March 25, 2026 17:55
pbinfo sumseq
/*
1 2 3 4
5 6 7 8
8 9 1 2
3 4 5 6
int numere[4] = {1,2,3,4};
0 1 2 3
int matrix[4][4];
@thinkphp
thinkphp / factorial.cpp
Created March 25, 2026 16:54
Pbinfo problema factorial
//n! = 1 * 2 * 3 * ..*n
//5! = 1 * 2 * 3 * 4 * 5 = 120
#include <iostream>
using namespace std;
int main()
{
long long int nr, s = 1, i;
@thinkphp
thinkphp / LIS.cpp
Created March 21, 2026 11:13
Longest Increasing Subsequence Dynamic PRogramming
/*
n = 5
V = 24 12 15 15 19
Longest Increasing Subsequence (LIS)
*/
#include <bits/stdc++.h>
@thinkphp
thinkphp / triangle-dynamic-programming.cpp
Created March 21, 2026 10:23
Triangle's problem Dynamic programming
#include <iostream>
#include <fstream>
#define FIN "triangle.in"
#define FOUT "triangle.out"
#define SIZE 101
using namespace std;
int i, n, Tri[SIZE][SIZE],