Skip to content

Instantly share code, notes, and snippets.

View akhilesh-kumar-verma's full-sized avatar

Akhilesh Kumar Verma akhilesh-kumar-verma

  • Delhi Technological University
  • Delhi, Delhi. India.
View GitHub Profile
#include <iostream>
#include <queue>
using namespace std;
struct TreeNode { int val;TreeNode *left;TreeNode*right; TreeNode(int val, TreeNode *left, TreeNode *right):val(val), left(left), right(right) {}; };
// 13 12 21 14 24 10 22 15 23
int main() {
TreeNode *root=new TreeNode(12, new TreeNode(13, nullptr, nullptr), new TreeNode(10, new TreeNode(14, new TreeNode(21, nullptr, nullptr), new TreeNode(24, nullptr, nullptr)), new TreeNode(15, new TreeNode(22, nullptr, nullptr), new TreeNode(23, nullptr, nullptr))));
queue<TreeNode *> Q; Q.push(root); int N1, N2; cin >> N1 >> N2;
#include<iostream>
#include<utility>
#include<vector>
using namespace std;
int main() {
size_t n; cin >> n;
vector<tuple<int,int, char, bool, size_t>> heros(n);
for (size_t i=0; i<n; ++i) { cin >> get<0>(heros[i]); }
for (size_t i=0; i<n; ++i) { cin >> get<1>(heros[i]); }
string str; cin >> str; for (size_t i=0; i<n; ++i) { get<2>(heros[i])=str[i]; }
#include <iostream>
using namespace std;
bool possible(unsigned long long n_b, unsigned long long n_s, unsigned long long n_c,
unsigned long long p_b, unsigned long long p_s, unsigned long long p_c,
unsigned long long r_b, unsigned long long r_s, unsigned long long r_c,
unsigned long long r, unsigned long long m) { return (m*r_b-n_b)*p_b+(m*r_s-n_s)*p_s+(m*r_c-n_c)*p_c<=r; }
int main() {
string reciepe; cin >> reciepe;
#include <iostream>
using namespace std;
int* max_element(int *begin, int *end) {
int *answer=begin;
for (int *iter=begin;iter!=end; ++iter) { if (*iter>*answer) { answer=iter; } }
return answer; }
int main() {
size_t N; cin >> N; int nums[N]; for (size_t i=0; i < N; ++i) { cin>>nums[i]; }
#include <iostream>
#include <vector>
using namespace std;
size_t cunt;
void TowerOfHanoi3(size_t n, size_t src, size_t aux, size_t dest, vector<string> &towers) {
if (n==0) { return; }
TowerOfHanoi3(n-1, src, dest, aux,towers);
++::cunt; cout << towers[src] << " -> " << towers[dest] << endl;
@akhilesh-kumar-verma
akhilesh-kumar-verma / connections.php
Created September 17, 2023 07:09
This is the default connections file used with the Library Management System's PHP project.
<?php
$connection=array(
'hostName'=>'localhost',
'userName'=>'root',
'password'=>'',
'database'=>'library'); ?>
/* tug_of_war.cpp
* This is soln of Tug of War problem of Coding Ninjas. This is O(pow(2, N)) time, O(1) space soln.
* https://www.codingninjas.com/codestudio/problem-details/tug-of-war_985253
* Date Created: 24 Feb, 2022
* Author: Akhilesh Kumar Verma
*/
int tugOfWar(vector<int> &arr, int n) {
int sum1 = arr.back(), sum2 = 0;
for (int ele: arr) {
/* hello_world.cpp
* This is Hello World of C++
* Date Created: 23 Feb, 2022
* Author: Akhilesh Kumar Verma
*/
#include <iostream>
using namespace std;
int main(int argc, char **argv) {