<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	
	xmlns:georss="http://www.georss.org/georss"
	xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
	>

<channel>
	<title>javascript &#8211; JSAlgorithm</title>
	<atom:link href="https://jsalgorithm.com/tag/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>https://jsalgorithm.com</link>
	<description></description>
	<lastBuildDate>Tue, 12 May 2020 19:55:42 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.5.15</generator>
<site xmlns="com-wordpress:feed-additions:1">177240629</site>	<item>
		<title>Two Sum</title>
		<link>https://jsalgorithm.com/2020/05/11/two-sum/</link>
					<comments>https://jsalgorithm.com/2020/05/11/two-sum/#respond</comments>
		
		<dc:creator><![CDATA[Ronald]]></dc:creator>
		<pubDate>Mon, 11 May 2020 20:59:01 +0000</pubDate>
				<category><![CDATA[Leetcode]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[leetcode]]></category>
		<guid isPermaLink="false">http://50.19.13.106/?p=21</guid>

					<description><![CDATA[function twoSum(nums, target) { let result = [], cache = {}; for (let i = 0; i &#60; nums.length; i++) { let x = target - nums[i]; if (cache[x] !== undefined) { result.push([cache[x], i]); } cache[nums[i]] = i; } return result; };]]></description>
										<content:encoded><![CDATA[
<pre class="wp-block-preformatted">function twoSum(nums, target) {
    let result = [],
        cache = {};
    for (let i = 0; i &lt; nums.length; i++) {
        let x = target - nums[i];
        if (cache[x] !== undefined) {
            result.push([cache[x], i]);
        }
        cache[nums[i]] = i;
    }

    return result;
};</pre>
]]></content:encoded>
					
					<wfw:commentRss>https://jsalgorithm.com/2020/05/11/two-sum/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">21</post-id>	</item>
		<item>
		<title>Valid Parenthesis</title>
		<link>https://jsalgorithm.com/2020/05/11/valid-parenthesis/</link>
					<comments>https://jsalgorithm.com/2020/05/11/valid-parenthesis/#respond</comments>
		
		<dc:creator><![CDATA[Ronald]]></dc:creator>
		<pubDate>Mon, 11 May 2020 20:57:08 +0000</pubDate>
				<category><![CDATA[Leetcode]]></category>
		<category><![CDATA[Parenthesis]]></category>
		<category><![CDATA[String]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[leetcode]]></category>
		<category><![CDATA[parenthesis]]></category>
		<category><![CDATA[string]]></category>
		<guid isPermaLink="false">http://50.19.13.106/?p=19</guid>

					<description><![CDATA[function validParenthesis(str) { let closingMap = { ')' : '(', ']' : '[', '}' : '{' } let chars = []; for(let i = 0; i &#60; str.length; i++) { if (str[i] === '(' &#124;&#124; str[i] === '[' &#124;&#124; str[i] === '{') { chars.push(str[i]); } else { let compare = chars.pop(); if (closingMap[str[i]] !== compare) [&#8230;]]]></description>
										<content:encoded><![CDATA[
<pre class="wp-block-preformatted">function validParenthesis(str) {<br><br>    let closingMap = {<br>        ')' : '(',<br>        ']' : '[',<br>        '}' : '{'<br>    }<br><br>    let chars = [];<br>    for(let i = 0; i &lt; str.length; i++) {<br>        if (str[i] === '(' || str[i] === '[' || str[i] === '{') {<br>            chars.push(str[i]);<br>        }<br>        else {<br>            let compare = chars.pop();<br>            if (closingMap[str[i]] !== compare) return false;<br>        }<br>    }<br>    return chars.length === 0;<br>}</pre>
]]></content:encoded>
					
					<wfw:commentRss>https://jsalgorithm.com/2020/05/11/valid-parenthesis/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">19</post-id>	</item>
		<item>
		<title>Binary Search</title>
		<link>https://jsalgorithm.com/2020/05/11/binary-search/</link>
					<comments>https://jsalgorithm.com/2020/05/11/binary-search/#respond</comments>
		
		<dc:creator><![CDATA[Ronald]]></dc:creator>
		<pubDate>Mon, 11 May 2020 20:52:28 +0000</pubDate>
				<category><![CDATA[Binary Search]]></category>
		<category><![CDATA[Recursion]]></category>
		<category><![CDATA[binary-search]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[recursion]]></category>
		<guid isPermaLink="false">http://50.19.13.106/?p=16</guid>

					<description><![CDATA[function binarySearch(arr, n, start = 0, end = arr.length) { let mid = Math.floor((end + start) / 2); if (arr[mid] === n) return mid; if (start &#60; end - 1) { if (n &#62; arr[mid]) { return binarySearch(arr, n, mid, end); } else { return binarySearch(arr, n, start, mid); } } return -1;}]]></description>
										<content:encoded><![CDATA[
<pre class="wp-block-preformatted">function binarySearch(arr, n, start = 0, end = arr.length) {<br>    let mid = <strong><em>Math</em></strong>.floor((end + start) / 2);<br>    if (arr[mid] === n) return mid;<br><br>    if (start &lt; end - 1) {<br>        if (n &gt; arr[mid]) {<br>            return binarySearch(arr, n, mid, end);<br>        } else {<br>            return binarySearch(arr, n, start, mid);<br>        }<br>    }<br>    return -1;<br>}</pre>
]]></content:encoded>
					
					<wfw:commentRss>https://jsalgorithm.com/2020/05/11/binary-search/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">16</post-id>	</item>
		<item>
		<title>Is Same Tree</title>
		<link>https://jsalgorithm.com/2020/05/11/is-same-tree/</link>
					<comments>https://jsalgorithm.com/2020/05/11/is-same-tree/#respond</comments>
		
		<dc:creator><![CDATA[Ron]]></dc:creator>
		<pubDate>Mon, 11 May 2020 20:45:14 +0000</pubDate>
				<category><![CDATA[Binary Tree]]></category>
		<category><![CDATA[Leetcode]]></category>
		<category><![CDATA[Recursion]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[leetcode]]></category>
		<category><![CDATA[recursion]]></category>
		<guid isPermaLink="false">http://50.19.13.106/?p=14</guid>

					<description><![CDATA[let isSameTree = function(p, q) { if (p === q) return true; if (p?.val !== q?.val) return false; return isSameTree(p.left, q.left) &#38;&#38; isSameTree(p.right, q.right);};]]></description>
										<content:encoded><![CDATA[
<pre class="wp-block-preformatted">let isSameTree = function(p, q) {<br><br>    if (p === q) return true;<br>    if (p?.val !== q?.val) return false;<br><br>    return isSameTree(p.left, q.left) &amp;&amp; isSameTree(p.right, q.right);<br>};</pre>
]]></content:encoded>
					
					<wfw:commentRss>https://jsalgorithm.com/2020/05/11/is-same-tree/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">14</post-id>	</item>
		<item>
		<title>Invert a Binary Tree</title>
		<link>https://jsalgorithm.com/2020/05/11/invert-a-binary-tree/</link>
					<comments>https://jsalgorithm.com/2020/05/11/invert-a-binary-tree/#respond</comments>
		
		<dc:creator><![CDATA[Ron]]></dc:creator>
		<pubDate>Mon, 11 May 2020 20:28:32 +0000</pubDate>
				<category><![CDATA[Binary Tree]]></category>
		<category><![CDATA[Leetcode]]></category>
		<category><![CDATA[Recursion]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[leetcode]]></category>
		<category><![CDATA[recursion]]></category>
		<guid isPermaLink="false">http://50.19.13.106/?p=7</guid>

					<description><![CDATA[let invertTree = function(root) { if (root) { const right = root.right; root.right = invertTree(root.left) root.left = invertTree(right) return root; } return null; };]]></description>
										<content:encoded><![CDATA[
<pre class="wp-block-preformatted">let invertTree = function(root) {

    if (root) {
        const right = root.right;
        root.right = invertTree(root.left)
        root.left = invertTree(right)
        return root;
    }
    return null;
};</pre>



<p></p>
]]></content:encoded>
					
					<wfw:commentRss>https://jsalgorithm.com/2020/05/11/invert-a-binary-tree/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">7</post-id>	</item>
	</channel>
</rss>
