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
/* | |
A boy is walking a long way from school to his home. To make the walk more fun he decides to add up all the numbers of the houses that he passes by during his walk. Unfortunately, not all of the houses have numbers written on them, and on top of that the boy is regularly taking turns to change streets, so the numbers don't appear to him in any particular order. | |
At some point during the walk the boy encounters a house with number 0 written on it, which surprises him so much that he stops adding numbers to his total right after seeing that house. | |
For the given sequence of houses determine the sum that the boy will get. It is guaranteed that there will always be at least one 0 house on the path. | |
Example | |
For inputArray = [5, 1, 2, 3, 0, 1, 5, 0, 2], the output should be |
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
I am travelling from Mumbai to SF, CA to travel to attend an conference, but Cathy Airline refused to checkin, | |
beacsue they say you passport is going to expire in next 6 month, | |
But I reviewed US SIX-MONTH CLUB update from CBP website where they allow user to travel from certain countries. | |
I discussed the same with other airlines (AIR INDIA), but I am not able to get any positive response | |
https://www.cbp.gov/sites/default/files/assets/documents/2017-Jan/Six-Month%20Club%20Update%2012-5-16.pdf |
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
// one-liner version | |
// retains latin-1 supplement chars as well as latin extended-a and latin extended-b | |
Shopify.handleize = function (str) { | |
return str.toLowerCase().replace(/[^\w\u00C0-\u024f]+/g, "-").replace(/^-+|-+$/g, ""); | |
}; |
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
// from https://github.com/Shopify/liquid/blob/63eb1aac69a31d97e343822b973b3a51941c8ac2/performance/shopify/shop_filter.rb#L100 | |
Shopify.handleize = function (str) { | |
str = str.toLowerCase(); | |
var toReplace = ['"', "'", "\\", "(", ")", "[", "]"]; | |
// For the old browsers | |
for (var i = 0; i < toReplace.length; ++i) { | |
str = str.replace(toReplace[i], ""); | |
} |