Skip to content

Instantly share code, notes, and snippets.


Hitesh Chopra hiteshchopra11

View GitHub Profile
hiteshchopra11 / duplicate_sorting.cpp
Created Feb 24, 2021
Find duplicate element using Sorting approach
View duplicate_sorting.cpp
#include <bits/stdc++.h>
using namespace std;
int sorting_duplicate(int arr[], int n)
//Sort the array using STL sort function or write own sorting algorithm(merge sort or heap sort)
sort(arr, arr + n);
for (int i = 1; i < n; i++)
//As the list is sorted,if two consecutive values are found, return the value as it is duplicate
hiteshchopra11 / duplicate_hashing.cpp
Last active Feb 24, 2021
Duplicate number using hashing
View duplicate_hashing.cpp
#include <bits./stdc++.h>
using namespace std;
int duplicate_hashing(int arr[], int n)
//Create a boolean value of size n
bool flag[n];
//Set all values of flag boolean array initially as false
fill(flag, flag + n, false);
View gist:9d247b37ef0b70bee577695ea2c7962e
{ "categories" : [ { "name" : "Movies",
"videos" : [
{ "description" : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\n",
"sources" : [ "" ],
"subtitle" : "By Blender Foundation",
"thumb" : "images/BigBuckBunny.jpg",
"title" : "Big Buck Bunny"
{ "description" : "The first Blender Open Movie from 2006",
"sources" : [ "" ],
View Routing.kt
routing {
get("/notes") {
val notes = arraylistof("Note 1","Note 2")
View RawDBQuery.kt
insert into t_note (id,note) values (?, ?)
View KtormQuery.kt
database.insert(Notes) {
 set(, "id")
 set(it.note, "note")
View NoteRequest.kt
data class NoteRequest(val note: String)
View InsertNote.kt
val request = call.receive<NoteRequest>()
val result = db.insert(NotesEntity) {
set(it.note, request.note)
View NoteResponse.kt
data class NoteResponse<T>(
val data: T,
val success: Boolean
View FetchNotes.kt
get("/notes") {
val notes = db.from(NotesResponse).select().map {
val id = it[]
val note = it[NotesEntity.note]
Note(id ?: -1, note ?: "")
// Returns the response to the User