<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>ARTSes on Eric Jin</title>
    <link>https://ericjin.com/blog/arts/</link>
    <description>Recent content in ARTSes on Eric Jin</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <lastBuildDate>Wed, 30 Oct 2019 14:02:31 +0800</lastBuildDate>
    <atom:link href="https://ericjin.com/blog/arts/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>ARTS WEEK 9</title>
      <link>https://ericjin.com/blog/ARTS/ARTS-WEEK9/</link>
      <pubDate>Wed, 30 Oct 2019 14:02:31 +0800</pubDate>
      <guid>https://ericjin.com/blog/ARTS/ARTS-WEEK9/</guid>
      <description>Algorithm Description Given an array nums of n integers and an integer target, find three integers in nums such that the sum is closest to target. Return the sum of the three integers. You may assume that each input would have exactly one solution. Example: Given array nums = [-1, 2, 1, -4], and target = 1. The sum that is closest to the target is 2. (-1 + 2 + 1 = 2).</description>
    </item>
    <item>
      <title>ARTS WEEK 8</title>
      <link>https://ericjin.com/blog/ARTS/ARTS-WEEK8/</link>
      <pubDate>Sat, 19 Oct 2019 17:10:33 +0800</pubDate>
      <guid>https://ericjin.com/blog/ARTS/ARTS-WEEK8/</guid>
      <description>Algorithm Description Given an array with n integers, your task is to check if it could become non-decreasing by modifying at most 1 element. We define an array is non-decreasing if array[i] &amp;lt;= array[i + 1] holds for every i (1 &amp;lt;= i &amp;lt; n). Example 1: Input: [4,2,3] Output: True Explanation: You could modify the first 4 to 1 to get a non-decreasing array. Example 2: Input: [4,2,1] Output: False Explanation: You can&amp;#39;t get a non-decreasing array by modify at most one element.</description>
    </item>
    <item>
      <title>ARTS-WEEK 7</title>
      <link>https://ericjin.com/blog/ARTS/ARTS-WEEK7/</link>
      <pubDate>Thu, 04 Apr 2019 12:16:10 +0800</pubDate>
      <guid>https://ericjin.com/blog/ARTS/ARTS-WEEK7/</guid>
      <description>Algorithm Description Given a 2D integer matrix M representing the gray scale of an image, you need to design a smoother to make the gray scale of each cell becomes the average gray scale (rounding down) of all the 8 surrounding cells and itself. If a cell has less than 8 surrounding cells, then use as many as you can.&#xA;Example 1:&#xA;Input: [[1,1,1], [1,0,1], [1,1,1]] Output: [[0, 0, 0], [0, 0, 0], [0, 0, 0]] Explanation: For the point (0,0), (0,2), (2,0), (2,2): floor(3/4) = floor(0.</description>
    </item>
    <item>
      <title>ARTS-WEEK 6</title>
      <link>https://ericjin.com/blog/ARTS/ARTS-WEEK6/</link>
      <pubDate>Wed, 13 Mar 2019 16:17:55 +0000</pubDate>
      <guid>https://ericjin.com/blog/ARTS/ARTS-WEEK6/</guid>
      <description>Algorithm Description Given an integer array, you need to find one continuous subarray that if you only sort this subarray in ascending order, then the whole array will be sorted in ascending order, too. You need to find the shortest such subarray and output its length. Example 1: Input: [2, 6, 4, 8, 10, 9, 15] Output: 5 Explanation: You need to sort [6, 4, 8, 10, 9] in ascending order to make the whole array sorted in ascending order.</description>
    </item>
    <item>
      <title>ARTS-WEEK 5</title>
      <link>https://ericjin.com/blog/ARTS/ARTS-WEEK5/</link>
      <pubDate>Sat, 08 Sep 2018 00:00:00 +0000</pubDate>
      <guid>https://ericjin.com/blog/ARTS/ARTS-WEEK5/</guid>
      <description>最近算法题倒是一天有写一道，不过总是无法抓住很好的review 和tip 来写,所以感觉写ARTS的时间总是耽搁又耽搁，比一起的间隔时间也长了好几天。&#xA;Algorithm LeetCode Count and Say,简单。 这题算是比较印象深刻的一题，最开始这一题的题目都没有看清楚，不知道这是什么意思。后面才明白，是后一个数去say 前一个数，得到后一个数之后继续。这样其实就可以算是一种递归了。因为我们知道了递归因子，和边界点。&#xA;Description The count-and-say sequence is the sequence of integers with the first five terms as following:&#xA;1. 1 2. 11 3. 21 4. 1211 5. 111221 1 is read off as &amp;quot;one 1&amp;quot; or 11. 11 is read off as &amp;quot;two 1s&amp;quot; or 21. 21 is read off as &amp;quot;one 2, then one 1&amp;quot; or 1211.&#xA;Given an integer n, generate the nth term of the count-and-say sequence.</description>
    </item>
    <item>
      <title>ARTS-WEEK 4</title>
      <link>https://ericjin.com/blog/ARTS/ARTS-WEEK4/</link>
      <pubDate>Mon, 27 Aug 2018 00:00:00 +0000</pubDate>
      <guid>https://ericjin.com/blog/ARTS/ARTS-WEEK4/</guid>
      <description>Algorithm LeetCode 第26题,简单。 最近一周没有太多时间写，还是自己的时间规划的不够好。要谨记于心。&#xA;Description Given a sorted array nums, remove the duplicates in-place such that each element appear only once and return the new length. Do not allocate extra space for another array, you must do this by modifying the input array in-place with O(1) extra memory. Example 1:&#xA;Given nums = **[1,1,2]**, Your function should return length = 2, with the first two elements of nums being 1 and 2 respectively.</description>
    </item>
    <item>
      <title>ARTS-WEEK 3</title>
      <link>https://ericjin.com/blog/ARTS/ARTS-WEEK3/</link>
      <pubDate>Mon, 20 Aug 2018 00:00:00 +0000</pubDate>
      <guid>https://ericjin.com/blog/ARTS/ARTS-WEEK3/</guid>
      <description>Algorithm Leetcode 第20题,简单。 决定先按照难易程度开始写leetcode,尽量能够每天或者两天写一道题目。一周记录一道题目到ARTS上面来。&#xA;Given a string containing just the characters &amp;#39;(&amp;#39;, &amp;#39;)&amp;#39;, &amp;#39;{&amp;#39;, &amp;#39;}&amp;#39;, &amp;#39;[&amp;#39; and &amp;#39;]&amp;#39;, determine if the input string is valid. An input string is valid if: Open brackets must be closed by the same type of brackets. Open brackets must be closed in the correct order. Note that an empty string is also considered valid. Example 1: Input: &amp;#34;()&amp;#34; Output: true Example 2: Input: &amp;#34;()[]{}&amp;#34; Output: true Example 3: Input: &amp;#34;(]&amp;#34; Output: false Example 4: Input: &amp;#34;([)]&amp;#34; Output: false Example 5: Input: &amp;#34;{[]}&amp;#34; Output: true 这题在旁边的related Topics 上面显示的是String、stack，所以可以猜测到本题的思路应该是从stack入手了。stack的特点是FILO(First in Last Out)，先进后出。</description>
    </item>
    <item>
      <title>ARTS-WEEK 2</title>
      <link>https://ericjin.com/blog/ARTS/ARTS-WEEK2/</link>
      <pubDate>Sat, 11 Aug 2018 00:00:00 +0000</pubDate>
      <guid>https://ericjin.com/blog/ARTS/ARTS-WEEK2/</guid>
      <description>Algorithm LeeCode 的第三题，中等难度。&#xA;Given a string, find the length of the longest substring without repeating characters. Examples: Given &amp;#34;abcabcbb&amp;#34;, the answer is &amp;#34;abc&amp;#34;, which the length is 3. Given &amp;#34;bbbbb&amp;#34;, the answer is &amp;#34;b&amp;#34;, with the length of 1. Given &amp;#34;pwwkew&amp;#34;, the answer is &amp;#34;wke&amp;#34;, with the length of 3. Note that the answer must be a substring, &amp;#34;pwke&amp;#34; is a subsequence and not a substring. 此题寻找字符串中最长的不重复字符子串。&#xA;起始思路是找每一个子串，然后每个子串没有重复字符。这个思路确实是最直接，最暴力的，但是也是最没有算法和数据结构的。&#xA;solution public int lengthOfLongestSubstring(String s) { int max = 0; for (int i = 0; i &amp;lt; s.</description>
    </item>
    <item>
      <title>ARTS-WEEK 1</title>
      <link>https://ericjin.com/blog/ARTS/ARTS-WEEK1/</link>
      <pubDate>Thu, 09 Aug 2018 00:00:00 +0000</pubDate>
      <guid>https://ericjin.com/blog/ARTS/ARTS-WEEK1/</guid>
      <description>Algorithm LeetCode 的第一题，比较简单。就是给一个数组，一个目标结果，返回数组中两个相加和为目标数的索引。&#xA;Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution, and you may not use the same element twice. Example: Given nums = [2, 7, 11, 15], target = 9, Because nums[0] + nums[1] = 2 + 7 = 9, return [0, 1]. 因为没有做过算法题，所以刚开始的思路就是跟简单排序一样，拿出第一个数，然后轮询后面的数，并相加，看它们的和是否等于目标数，不等于就拿出第二个数往后，等于就返回索引。&#xA;public int[] twoSum(int[] nums, int target) { for (int i = 0; i &amp;lt; nums.</description>
    </item>
  </channel>
</rss>
