This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { "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\nhttp://www.bigbuckbunny.org", | |
| "sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" ], | |
| "subtitle" : "By Blender Foundation", | |
| "thumb" : "images/BigBuckBunny.jpg", | |
| "title" : "Big Buck Bunny" | |
| }, | |
| { "description" : "The first Blender Open Movie from 2006", | |
| "sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" ], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| routing { | |
| get("/notes") { | |
| val notes = arraylistof("Note 1","Note 2") | |
| call.respond(notes) | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| insert into t_note (id,note) values (?, ?) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| database.insert(Notes) { | |
| set(it.id, "id") | |
| set(it.note, "note") | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Serializable | |
| data class NoteRequest(val note: String) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| val request = call.receive<NoteRequest>() | |
| val result = db.insert(NotesEntity) { | |
| set(it.note, request.note) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Serializable | |
| data class NoteResponse<T>( | |
| val data: T, | |
| val success: Boolean | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| get("/notes") { | |
| val notes = db.from(NotesResponse).select().map { | |
| val id = it[NotesEntity.id] | |
| val note = it[NotesEntity.note] | |
| Note(id ?: -1, note ?: "") | |
| } | |
| // Returns the response to the User | |
| call.respond(notes) | |
| } |
OlderNewer