<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Dexty Genius</title>
    <description>The latest articles on DEV Community by Dexty Genius (@dextygenius).</description>
    <link>https://dev.to/dextygenius</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F885192%2Ffae21a66-8715-48fb-958f-38b6697ab833.jpg</url>
      <title>DEV Community: Dexty Genius</title>
      <link>https://dev.to/dextygenius</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/dextygenius"/>
    <language>en</language>
    <item>
      <title>How do you solve this problem using javascript</title>
      <dc:creator>Dexty Genius</dc:creator>
      <pubDate>Thu, 30 Jun 2022 16:04:15 +0000</pubDate>
      <link>https://dev.to/dextygenius/how-do-you-solve-this-problem-using-javascript-53i</link>
      <guid>https://dev.to/dextygenius/how-do-you-solve-this-problem-using-javascript-53i</guid>
      <description>&lt;p&gt;While a user is downloading a file which is X bytes in size, your job is to provide a function to estimate the time remaining in minutes. The system has a record of the amount (in bytes) B downloaded each minute.&lt;/p&gt;

&lt;p&gt;If the file is not completely downloaded, estimate the rate by taking the simple average of the last Z observations.&lt;/p&gt;

&lt;p&gt;Write a function:&lt;/p&gt;

&lt;p&gt;function solution(X, B, Z);&lt;/p&gt;

&lt;p&gt;that returns the amount of time remaining in minutes. X is an integer representing the file size. B is an array of integers listing the bytes downloaded at each minute starting from the beginning of the download until now. Return an integer representing the number of minutes remaining. Z is an integer. You may assume that all the values are reasonable.&lt;/p&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;p&gt;X=100, B=[10,6,6,8], Z=2 30 bytes = 10+6+6+8 have been downloaded. So 70 bytes remain. The average of the last two minutes (Z=2) is 7=(6+8)/2. So the function should return 10 minutes (=70/7).&lt;br&gt;
Note that:&lt;/p&gt;

&lt;p&gt;If there are fewer than Z observations, use what you do have.&lt;br&gt;
Your estimate should be rounded up to the nearest integer (ceiling).&lt;br&gt;
If the download is done, return 0&lt;br&gt;
If you are unable to produce an estimate, return -1.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How do you write a javascript function for this problem</title>
      <dc:creator>Dexty Genius</dc:creator>
      <pubDate>Thu, 30 Jun 2022 16:02:15 +0000</pubDate>
      <link>https://dev.to/dextygenius/how-do-you-write-a-javascript-function-for-this-problem-909</link>
      <guid>https://dev.to/dextygenius/how-do-you-write-a-javascript-function-for-this-problem-909</guid>
      <description>&lt;p&gt;From an integer X representing a time duration in seconds produce a simplified string representation.&lt;/p&gt;

&lt;p&gt;For example, given:&lt;br&gt;
100&lt;br&gt;
You should output:&lt;br&gt;
"1m40s"&lt;/p&gt;

&lt;p&gt;Use the following abbreviations w,d,h,m,s to represent:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;1w is 1 week&lt;/li&gt;
&lt;li&gt;1d is 1 day&lt;/li&gt;
&lt;li&gt;1h is 1 hour&lt;/li&gt;
&lt;li&gt;1m is 1 minute&lt;/li&gt;
&lt;li&gt;1s is 1 second&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Only the two largest non-zero units should be used. Round up the second unit if necessary so that the output only has two units even though this might mean the output is for slightly more time than X seconds.&lt;/p&gt;

&lt;p&gt;Write a function:&lt;/p&gt;

&lt;p&gt;function solution(X);&lt;/p&gt;

&lt;p&gt;that, given an integer X, returns a string representing the duration.&lt;/p&gt;

&lt;p&gt;Examples:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Given X=100, return "1m40s"&lt;/li&gt;
&lt;li&gt;Given X=7263, return "2h2m". (7263s=2h1m3s, but this uses too many units, so we round the second largest unit up to 2h2m)&lt;/li&gt;
&lt;li&gt;Given X=5, return "5s"&lt;/li&gt;
&lt;/ol&gt;

</description>
    </item>
  </channel>
</rss>
