Pattern: digit/string scan
Move: Convert number to string → count "0" → if count is odd, increment answer.
Mistake to avoid: Do not overthink. This is just scan/count/rule.
| Latency Comparison Numbers (~2012) | |
| ---------------------------------- | |
| L1 cache reference 0.5 ns | |
| Branch mispredict 5 ns | |
| L2 cache reference 7 ns 14x L1 cache | |
| Mutex lock/unlock 25 ns | |
| Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
| Compress 1K bytes with Zippy 3,000 ns 3 us | |
| Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
| Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
| YouTube video link: https://youtu.be/8Uofkq718n8 | |
| All the commands that are executed in the above youtube video are mentioned in this gist. | |
| 1. Install Apache server on Ubuntu | |
| sudo apt install apache2 | |
| 2. Install php runtime and php mysql connector | |
| sudo apt install php libapache2-mod-php php-mysql | |
| 3. Install MySQL server |
| <!doctype html> | |
| <html> | |
| <head> | |
| <title>Randomize List Using jQuery</title> | |
| <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet"> | |
| <style type="text/css"> | |
| .list { | |
| width:600px; | |
| margin:0 auto; |
This process worked for me. I take no responsibility for any damage or loss incurred as a result of following or not following these steps or, for that matter, anything else you might do or not do.
svn.domain.com.au.http (other protocols should work).git.domain.com.au and:| <!DOCTYPE html> | |
| <html data-ng-app="TestApp"> | |
| <head> | |
| <script src="http://code.angularjs.org/1.2.9/angular.js"></script> | |
| <script> | |
| angular.module('TestApp', []) | |
| .factory('beforeUnload', function ($rootScope, $window) { | |
| // Events are broadcast outside the Scope Lifecycle |
| /** | |
| * largestRemainderRound will round each number in an array to the nearest | |
| * integer but make sure that the the sum of all the numbers still equals | |
| * desiredTotal. Uses Largest Remainder Method. Returns numbers in order they | |
| * came. | |
| * | |
| * @param {number[]} numbers - numbers to round | |
| * @param {number} desiredTotal - total that sum of the return list must equal | |
| * @return {number[]} the list of rounded numbers | |
| * @example |
| 1. Multiple branches: | |
| https://marketplace.visualstudio.com/items?itemName=donjayamanne.githistory | |
| 2.https://stackoverflow.com/questions/42112526/how-to-compare-different-branches-in-visual-studio-code |
| import { AbstractControl } from '@angular/forms'; | |
| import {Observable, Observer, of} from 'rxjs'; | |
| export const mimeType = ( | |
| control: AbstractControl | |
| ): Promise<{ [key: string]: any }> | Observable<{ [key: string]: any }> => { | |
| if (typeof(control.value) === 'string') { | |
| return of(null); | |
| } | |
| const file = control.value as File; |
| I have a keen interest in design patterns as I try to reshape my interst to writing code for day to day and rather, doing | |
| architecture, code reviews, business meetings, etc. This means I must understand design patterns as this would also help me | |
| to understand how to read code. | |
| Of My head the following patterns are what I know: | |
| 1. Singleton | |
| 2. Factory | |
| 3. Facade | |
| 4. |