Git Product home page Git Product logo

arpankg / ctci-python-solutions Goto Github PK

View Code? Open in Web Editor NEW
1.1K 50.0 160.0 89 KB

Cracking the Coding Interview in Python 3. The solutions all have detailed explanations with visuals.

Home Page: https://quastor.org/cracking-the-coding-interview/arrays-and-strings/one-away

cracking-the-coding-interview interview-questions interview-preparation interview-practice python3 python gayle-laakmann-mcdowell

ctci-python-solutions's People

Contributors

arpankg avatar farhanjune avatar fediaz3 avatar gan3i avatar konantian avatar rohit-lunavara avatar subash774 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

ctci-python-solutions's Issues

Solution 1.4 - Incorrect dictionary iterator

Line 43 should use the items() method over the dictionary to return (key, value) pairs.

for (key, value) in counts.items():

Or, use the values() method over the dictionary since we are only checking values.

for value in counts.values():

Generating webpages from .mdx

Hey @arpan74,
I was going through CTCI chapter 16 - Moderate so thought I might as well contribute as I am doing them anyway.

Question:
Are the links dynamically generated or are they hardcoded? I am referring to the header and readme status links to "Read solution".
In other words, if I was to push a file explaining question 16.1, how would you want me to format the header? Leave the link as blank so you can update them later or are these mdx file fed into a system somewhere that generates dynamic webpages as the mdx files are pushed to this repo?

Solution links

Great work with the solutions! I've been trying to access the solution links but I keep getting 404 error.

Solution 1.8 - Incorrect output matrix

The output matrix should be:
[
[1, 0, 3, 0],
[0, 0, 0, 0],
[6, 0, 1, 0],
[0, 0, 0, 0]
]
instead of
[
[1,0,3,4],
[5,0,7,8],
[6,0,1,2],
[0,0,0,0]
]

row 2 (matrix[1]) becomes 0 because matrix[1][1] (item next to 5 in second row) is 0 and the last column becomes 0 because the last item in the column is 0.

Solution 1.4

Hello! This is my first time using GitHub, so I apologize if this is comment is old news. I wanted to see if this particular solution for question 1.4 might be considered as another option. Thank you for creating this repo! I've been enjoying it.

You are given a string. Write a function that checks if the letters in the string can be rearranged to form a palindrome (or if the input is already a palindrome). You can ignore spaces in the string.

def palindrome(s):
  # Remove spaces
  s = s.replace(" ","")
  # Check if s is == the reversed s
  return s == s[::-1]`

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.