Skip to content

Latest commit

 

History

History
27 lines (22 loc) · 696 Bytes

File metadata and controls

27 lines (22 loc) · 696 Bytes

Screen Shot 2022-07-18 at 02 22 19

Screen Shot 2022-07-18 at 02 22 28

function findShort(s) {
  s = s.split(" ");
  let res = Infinity;
  let count = 0;
  for (let i = 0; i < s.length; i++) {
    for (let j = 0; j < s[i].length; j++) {
      count++;
    }
    res = Math.min(res, count);
    count = 0;
  }
  return res;
}
function findShort(s) {
  return Math.min(...s.split(" ").map((s) => s.length));
}