careercup / ctci-6th-edition-javascript Goto Github PK
View Code? Open in Web Editor NEWCracking the Coding Interview 6th Ed. JavaScript Solutions
Cracking the Coding Interview 6th Ed. JavaScript Solutions
line 18 should read:
The provided solution assumes that any computed compressed string "compressed" will be shorter than the provided string "string" only if the maximum count for every input is 1. This is incorrect. Take the counterexample string "abcdd" (len:5). When compressed by the given solution, the proposed compressed string is given as "a1b1c1d2" (len:8). A better solution would be to simply compare the lengths of the given string before returning.
Would it make sense to change the params for the solutions to take a string rather than an array? I was thrown off by the use of sort in the second solution until I realized the "str" variable was actually an array.
The problem in the book clearly requests an implementation of an algorithm that works on a string. I suppose this is something the candidate could/should check before hand so I can understand reasoning for leaving it in.
Would love to see someone else take this over. It's not worth it for me currently to devote time or effort to work on this.
All the best ✌️❤️
For this problem, why wouldn't you do something along the lines of:
var uglify = function(input) {
input = input.trim();
var url = input.split(' ').join('%20');
return url;
}
I know it says that it provides with the true length of the string, but would something a long these lines not be acceptable?
Add instructions on How to Contribute on CONTRIBUTING.md
Looks like there's a solution to a different problem for the N Queens file:
Travis or Circle. Would be awesome for linting and unit testing both. Both options are free for open-source software and provide a much higher code quality for PR's.
Need to add "dawsonbotsford" to the CarreerCup org as a person by @gaylemcd or another stake-holder on the careercup GitHub group if I understand the permissions correctly.
The Problem:
The answer to question 2.8 is incomplete.
The code in these answers seems to only return true or false as to whether there is a loop in the linked list, instead of the node at the start of the loop.
The Solution:
I could set up a pull request for this.
Is it possible to have access to push new solutions?
function urlify(str, length) {
var arr = str.trim().split('');
arr.forEach((item, i) => {
if ( item === ' ' ) arr[i] = '%20';
});
return arr.join('');
};
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.