Skip to content

Instantly share code, notes, and snippets.

View manish-manghwani's full-sized avatar
💬

Manish Manghwani manish-manghwani

💬
View GitHub Profile
@manish-manghwani
manish-manghwani / 1. RouteProcessor.kt
Created July 20, 2024 08:45 — forked from SubSide/1. RouteProcessor.kt
An easy way to register controller methods in Ktor. This helps clean up some code.
import io.ktor.application.ApplicationCall
import io.ktor.application.call
import io.ktor.http.HttpMethod
import io.ktor.routing.Route
import io.ktor.routing.Routing
import io.ktor.routing.route
import kotlin.reflect.KFunction
import kotlin.reflect.full.callSuspendBy
import kotlin.reflect.full.declaredMemberFunctions
import kotlin.reflect.jvm.javaType
public class NotDuplicate {
public static void main(String[] args) {
int[] nums = {1,2,2,1,3,4,4};
int result = 0;
for (int i = 0; i < nums.length; i++) {
System.out.println("before result : "+result);
result ^= nums[i];
System.out.println("nums[i] : "+nums[i]);
System.out.println("result : "+result);
import java.io.*;
import java.util.*;
public class Solution {
public static void main(String[] args) {
/* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
Scanner sc = new Scanner(System.in);
import java.io.*;
import java.util.*;
public class Solution {
public static void main(String[] args) {
/* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] inputArr = new int[n];
function maxArea(height: number[]): number {
let leftPointer = 0;
let rightPointer = height.length-1;
let minHeight = 0;
let maxArea = 0;
while (leftPointer < rightPointer) {
minHeight = height[leftPointer] < height[rightPointer]
? height[leftPointer]
: height[rightPointer];
function hourglassSum(arr) {
let resArray = Array(4);
let rowLimit = 0;
let colLimit = 0;
for (let i = 1; i<=16; i++) {
if(i%4 == 0 ) {
rowLimit = 0;
}
if(colLimit == 4) {
colLimit = 0;
function maxSubArray(nums: number[]): number {
let current_max = nums[0]
let global_max = nums[0]
if(nums.length == 1) {
return current_max;
}
for (let i= 1 ; i<nums.length ; i++) {
current_max = current_max + nums[i] >= nums[i] ? current_max + nums[i] : nums[i]
global_max = current_max > global_max ? current_max : global_max
function kidsWithCandies(candies: number[], extraCandies: number): boolean[] {
let max = 0;
for(let i=0; i<candies.length ; i++ ){
max = candies[i] > max? candies[i] : max
}
let result = [];
for(let i=0; i<candies.length ; i++ ){
result.push(candies[i] + extraCandies >= max ? true : false )
}
@manish-manghwani
manish-manghwani / leetcode:easy:shuffle-the-array.ts
Last active September 27, 2020 05:48
Leet code problems in ts
function shuffle(nums: number[], n: number): number[] {
let res = [];
for(let i=0 ; i<n; i++) {
res.push(nums[i])
res.push(nums[n+i])
}
return res;
};
#!/bin/sh
input=$(whiptail --inputbox "Encrypt input" 8 39 input --title "Encryption Utility" 3>&1 1>&2 2>&3)
selectedOption=$(whiptail --title "Utilities" \
--radiolist "Select Utility:" 10 80 3 \
1 bcrypt on \
2 Argon2i off \
3 Argon2iD off \
3>&1 1>&2 2>&3)