Skip to content

Instantly share code, notes, and snippets.

View nhnam's full-sized avatar
💭
Play hard, work harder

ナ-ム Nguyen nhnam

💭
Play hard, work harder
View GitHub Profile
{https://m.facebook.com}/pages/launchpoint/admin_invites/
{https://m.facebook.com}/pages/launchpoint/liked_pages/
{https://m.facebook.com}/pages/launchpoint/owned_pages/
{https://m.facebook.com}/pages/launchpoint/pending_invites/
fb-service://limit_friend_requests
fb://about
fb://account/recovery
fb://account_settings
@nhnam
nhnam / podforceupdate.sh
Created June 2, 2023 07:32 — forked from mbinna/podforceupdate.sh
Clear CocoaPods cache, re-download and re-install all pods
#!/usr/bin/env bash
rm -rf "${HOME}/Library/Caches/CocoaPods"
rm -rf "`pwd`/Pods/"
pod update
@nhnam
nhnam / AppDelegate10.m
Created July 14, 2022 08:55 — forked from jzucker2/AppDelegate10.m
UserNotifications on iOS 10
// Make sure to include this at the top of AppDelegate.m
@import UserNotifications;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
// Check Notification Settings on launch
[[UNUserNotificationCenter currentNotificationCenter] getNotificationSettingsWithCompletionHandler:^(UNNotificationSettings * _Nonnull settings) {
switch (settings.authorizationStatus) {
// This means we have not yet asked for notification permissions
case UNAuthorizationStatusNotDetermined:
function arrayManipulation(n, queries) {
// Write your code here
var arr = Array(n + 1).fill(0);
var max = 0;
var x = 0;
for(var query of queries) {
const [a, b, k] = query;
arr[a] += k;
if(b+1 <= n) {
arr[b+1] -= k;
// Complete the minimumSwaps function below.
function minimumSwaps(arr) {
var swaps = 0;
for(var i=0; i< arr.length; i++) {
while(arr[i] !== i + 1) {
let j = arr[i] - 1;
let tem = arr[i];
arr[i] = arr[j];
arr[j] = tem;
swaps ++;
function Node(key) {
this.key = key;
this.left = null;
this.right = null;
this.parent = null;
}
function BSTree() {
this.root = null;
}
class TrieNode {
var key: Character?
var children: [Character: TrieNode] = [:]
weak var parent: TrieNode?
var end: Bool
init(_ key: Character?) {
self.key = key
self.children = [:]
self.parent = nil
self.end = false
const romanCode = {
1000:'M',
900: 'CM',
500:'D',
400: 'CD',
100: 'C',
90: 'XC',
50: 'L',
40: 'XL',
/*Roman to Decimal*/
/**
Algorithm
Loop through each character in the string containing the roman numerals.
Compare the value of the current roman symbol with the value of the roman symbol to its right.
If the current value is greater than or equal to the value of the symbol to the right, add the current symbol’s value to the total.
If the current value is smaller than the value of the symbol to the right, subtract the current symbol’s value from the total.
**/
@nhnam
nhnam / ATM.js
Created December 13, 2020 13:21
/* ATM */
/**
Input the amount, return the notes
Asume that there are types: 1000, 100, 50, 10, 5, 2, 1
Example: 1200 USD:
**/
let result = {};
let notes = [100, 50, 10, 5, 2, 1];
let index = 0;