Giter VIP home page Giter VIP logo

algocasts's Introduction

algocasts's People

Contributors

stephengrider avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

algocasts's Issues

Palindrome - some tests are passing without implementation

palindrome/test.js

  ✓ palindrome function is defined (2ms)
  ✕ "aba" is a palindrome
  ✓ " aba" is not a palindrome
  ✓ "aba " is not a palindrome (1ms)
  ✓ "greetings" is not a palindrome
  ✕ "1000000001" a palindrome
  ✓ "Fish hsif" is not a palindrome
  ✕ "pennep" a palindrome

LICENSE please

Courses are paid but what about course material?
Shouldn't the material be open source so that students can fork freely?

anagrams edge cases

I forgot to put the global tag in my regex replace, and the tests still passed, but the example test in the description doesn't.

anagrams('RAIL! SAFETY!', 'fairy tales') --> True

Maybe add this in the test as well just to make sure all edge cases are covered.

Missing export for Sort algorithm

Minor issue, but it seems that it is missing an export for the merge function for the sort.js in the algorithm.

Currently it is this:
module.exports = { bubbleSort, selectionSort, mergeSort };

It should be:
module.exports = { bubbleSort, selectionSort, mergeSort, merge };

completed_exercises/maxchar/index.js

The solution should not avoid the second loop?

function maxChar(str) {
  const charMap = {};
  let max = 0;
  let maxChar = '';

  for(let element of str) {
    charMap[element] = charMap[element] ? charMap[element] + 1 : 1;

    if(charMap[element] >  max) {
      max = charMap[element];
      maxChar = element
    }
  }

  return maxChar;
}

instead of

function maxChar(str) {
  const charMap = {};
  let max = 0;
  let maxChar = '';

  for (let char of str) {
    if (charMap[char]) {
      charMap[char]++;
    } else {
      charMap[char] = 1;
    }
  }

  for (let char in charMap) {
    if (charMap[char] > max) {
      max = charMap[char];
      maxChar = char;
    }
  }

  return maxChar;
}

What about this solution for the maxChar function?

function maxChar(str) {
  let groupedChars = {};
  str.split("").forEach(character => {
    groupedChars[character] = !!groupedChars[character]
      ? groupedChars[character] + 1
      : 1;
  });
  const values = Object.values(groupedChars);
  return Object.keys(groupedChars)[values.indexOf(Math.max(...values))];
}

False positive on maxChar exercise

Hello! I was writing a solution for your maxChar problem and I passed all your tests. However, when I ran the solution against string 'cacacbb', it returned 'b' instead of 'c'. Since my faulty function has passed all the original tests, I assume other students could have the same issue, so I added:

expect(maxChar('cacacbb')).toEqual('c');

to AlgoCasts/exercises/maxchar/test.js
Here is the link to my pull request: #3

Here is my faulty function that passed the original tests:
function maxChar(str) {
var letter;
var count = 0;
str.split('').forEach((item, index) => {
if(letter === undefined || item === letter) {
letter = item;
count++;
} else {
if(count === 1){
letter = item
}
}
});
return letter;
}

reverseString - typo in comment

There seems to be a typo in AlgoCasts/exercises/reversestring/index.js:
// reverse('apple') === 'leppa'

Here the expected value should be 'elppa' instead of 'leppa'

error in execution of index.js by jest command

this is the error
No tests found, exiting with code 1
Run with --passWithNoTests to exit with code 0
In C:\Users\pawan\Desktop\AlgoCasts\completed_exercises
62 files checked.
testMatch: /tests//.[jt]s?(x), **/?(.)+(spec|test).[tj]s?(x) - 27 matches
testPathIgnorePatterns: \node_modules\ - 62 matches
testRegex: - 0 matches
Pattern: index.js - 0 matches

Anagram tests don't check for punctutations

I was just working through the anagram section of the exercises and I realized that one the examples given in the problem definition are not being checked by the test code. I propose adding a simple test to check for the same.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.