• Breaking News

    Saturday, November 10, 2018

    An interesting problem from a job Interview at Google to practice during the weekend. I'll be posting solutions tomorrow. (difficulty = medium) learn programming

    An interesting problem from a job Interview at Google to practice during the weekend. I'll be posting solutions tomorrow. (difficulty = medium) learn programming


    An interesting problem from a job Interview at Google to practice during the weekend. I'll be posting solutions tomorrow. (difficulty = medium)

    Posted: 09 Nov 2018 02:37 PM PST

    Hello folks! Yesterday I watched a video of a (supposed) Google interview problem that is REALLY interesting. I loved it. It's simple to explain and understand, and it has many different solutions. The most interesting part is that the solutions range from simple not so efficient ones, to some really smart ones (I have actually 4 in mind, maybe we can find others) that are more efficient and more "technically" advanced (introducing time complexity for example).

    So I thought it'd be a good idea to introduce it to the community, giving people some time to hack at it, and then posting the solutions explained. We might even find new solutions for it.

    Problem definition

    See a detailed explanation here

    Given a list containing integers in order, for example: [1, 3, 5, 8, 12, 13, 22] and a target number, for example 16.

    Can you find a pair of numbers whose sum equals the target number?

    Here's a more graphical definition of it: https://media.giphy.com/media/1oDuNxmD6dBMkFhRIO/giphy.gif

    (Also some tests included here).

    Examples

    For our original list:

    l = [1, 3, 5, 8, 12, 13, 22]

    • Is there a pair that adds up to 16? YES 😁: 3 + 13.
    • Is there a pair that adds up to 19? NO 😩.
    • Is there a pair that adds up to 20? YES 😁: 8 + 12.
    • Is there a pair that adds up to 33? NO 😩.

    Solutions

    I'll post the first solution tomorrow at 2PM Eastern! You can comment with ideas but try not to spoil the solutions 🙏. The second solution (a little bit smarter) will be posted on Sunday, also at 2PM Eastern.


    PS: The video with the whole explanation and solutions is online and belongs to Google's official account, I will not post it so I don't spoil the solutions, but I'll share it later. You can do a quick search and find it if you're curious, but I'd recommend not to do it (until you give the problem some thought 😁).

    submitted by /u/santiagobasulto
    [link] [comments]

    When setting up a compiler becomes harder task than to code!

    Posted: 09 Nov 2018 11:06 PM PST

    I am determined to learn SFML with C++. And a shit is going on. I am pretty much tired because I couldn't set up CMake,SFML with code-blocks. I am good in coding; but bad in setting up the compiler, how can I remove this?

    How can I set up CMake, SFML and code::blocks ?

    submitted by /u/Sci-Techtop
    [link] [comments]

    This Fibonacci sequence exercise really had me frustrated but I think I figured it out and it was great practice.

    Posted: 09 Nov 2018 02:06 PM PST

    I'm absolutely awful with math so this actually took me all day to get working, it *seems* right but I wouldn't mind some criticism or advice if I made any glaring errors or if it looks like I might be forming bad habits. Exercise 13 from www.practicepython.org

    num1 = 0 num2 = 0 while num2 == 0: try: num1 = int(input("I'll make some fibonacci numbers for you, from what number should I start: ")) num2 = int(input("and how many numbers do you want in the sequence: ")) except: print("Invalid entry, try again.\n") continue fibonacci = [0, num1] def fib(number1, number2): while len(fibonacci) < num2: x = fibonacci[-2] + fibonacci[-1] fibonacci.append(x) return fibonacci print(fib(num1, num2)) 

    EDIT: I see my glaring inconsistency now, i'm going to get some coffee and nail it down.

    EDIT 2: I think I cleared it up by just editing the wording of the inputs.

    submitted by /u/Rddt_fr_wrk
    [link] [comments]

    Interested in almost everything you can do with programming. Confused on where to start.

    Posted: 09 Nov 2018 08:56 PM PST

    I am a former Electrical Engineering Technology student who is now switching his major to Computer Science. I have been interested in programming for some time now but have been dissuaded by friends and peers. I don't know where to start in this new journey. I like almost everything it has to offer from robotics to game development and have bought several books about different languages such as Python, C & C++ (Which i took in College) and now C#. Been kinda all over the place as of right now but I know from reading posts on reddit and online that I need to stick with one to get the basics. Any suggestions on how to approach my situation or should I just start to do one field and see if I like it or not. Thanks in advance!

    submitted by /u/AnbuDota
    [link] [comments]

    Anyone have best resources for learning about computers in general? (Hardware, Software, etc.)

    Posted: 09 Nov 2018 08:24 PM PST

    I am currently pursuing Computer Science in University and feel like a lot of the professionals that can do cool things know the ins and outs of computers. I feel like I'm missing a few key terms/basic vocabulary of computers at the moment. I'm currently going through a CompTIA A+ 220-901 video but was just curious if there are any others you guys would recommend.

    submitted by /u/AutumnSail
    [link] [comments]

    Is it possible to learn with a full time job? I need your advice guys

    Posted: 09 Nov 2018 08:34 AM PST

    Ok so context: Im a 20 year old guy from Croatia who currently works as a carpenter from 8am to 15pm (most of the time it draws out so im at work untill 16 or 17).

    Now recently i decided i wanna move on from physical jobs and since im good with computers i got into learning programming on my own,with my goal being becoming a web developer(front end eventually moving on to full-stack) and im currently learning JS,HTML,and CSS. Now im still completely new,i only completed the Codecademy courses on JS and HTML, and while i feel like im not bad at it,and im making good progress its just so slow with a full time job. Between juggling my social life,work,and studying i barely managed to complete the JS course in 3 months.

    And thats mostly beacuse i always come home completely drained from work and i just wanna lie the fuck down and not do anything cuz im so tired ( carpentry obviously a very physical draining job). It takes a lot of mental fortitude for me to study hard after work. Ive been thinking about quitting my job and just diving completely into studying, but that would mean i wont have any money and i dont wanna be asking my parents back with money again so i really dont know.

    If i quit my job and just start only studying i wont have any money for my social life etc and i would probbably confine myself to my house only for a better part of the year. But if that means im gonna become a developer faster then i think im ready for that. Or do i just have to push through and learn how to study after work ? Which seems hard as hell

    The problem is i love going out and stuff with my friends im not sure if i can give that up just like that? What do u guys think?

    submitted by /u/Throwaway_Kappalul
    [link] [comments]

    Need some thoughts on material, and which language to learn.

    Posted: 09 Nov 2018 11:56 PM PST

    I'm wanting to find a good website to learn coding. I would like to learn in a professional way, and I'm willing to pay money for help (not that much). I found mmtuts on youtube, and I've learned html and css from his material so far.

    I'm looking at teamtreehouse and udemy which looks like they both have good material. I'm really wanting to learn python as well as it does interest me in the things you can do. Should I just drop html and css for python, or do both?? Also what do you prefer teamtreehouse, udemy or any recommendations??

    submitted by /u/Bubba024
    [link] [comments]

    Hesitant About Starting A Youtube

    Posted: 09 Nov 2018 11:49 PM PST

    So honestly something I really think about a lot is having a youtube channel. I am so comfortable in front of a camera and I think I could make some interesting videos. I was thinking of having it mainly themed from a beginners learning process and seeing how advance I get one day as the channel goes on. I feel everyone has a unique experience when it comes to programming but there is similarities in everyones path's too like all those "Ah-ha" moments you had when learning. I also want to review things I have done like the fullstack bootcamp prep course in nyc, I have some cool ideas about what to talk about with interesting API's like the "Star Wars API". And aside from that I am really into PC gaming so maybe having something incorporating that too. So for some reason I am just hesitant on actually starting this whole thing even though its something I dream about. Does anyone think this is a bad idea or boring concept or something? Or does this actually sound kinda fun and useful. I love this subreddit so I really take in the opinions from here. Let me know what you guys think...Thank you all <3

    submitted by /u/findingjake
    [link] [comments]

    What is the best way for my dad, 52, to get into programming as a profession?

    Posted: 09 Nov 2018 11:35 PM PST

    So some background: My dad, 52, with a Masters in Engineering from a T20 school, has never actually had a job. He traded stocks from the moment he got out of college until now, and things have been going south for the last few years. His degree is basically worth nothing now since he hasn't held a job in the fields since he got his Masters at age 26. He wants to begin learning programming, and eventually use it to get a job (right now he's just doing minimum wage stuff).

    I myself am in HS and will be going to college majoring in CS next year, and I feel that I can pretty confidently teach him the basics of Java and/or C++, and that he could from that point teach himself. The problem is that he realistically can't obtain a job without some certificate. He was thinking of enrolling in our local CC and getting an Associates (I took an Intro to CS class there over the past summer and absolute loved it). Thoughts on this predicament? Thanks in advance everyone.

    submitted by /u/TheRealKingofmice
    [link] [comments]

    Advice to beginners on paradigm hype

    Posted: 09 Nov 2018 11:33 PM PST

    I bet some of you have read a headline somewhere, Medium etc. where the headline states something to the effect of "[functional/Object] programming and why I'm done with [functional/object] programming"

    I've read a lot of articles that are proclaiming something to the sort. I guess programming attracts people with a tendency to double down on whatever works in the moment for all scenarios (vim/emacs anyone)?

    Take it from me: CHILL and don't worry about this shit. This kind of stuff can make beginners think "oh am I learning the correct style?" and the answer is: that's not your goal. Your goal is to learn abstraction, logic, boolean etc. computer science ideas and then learn a language. Don't worry about paradigms like OOP or Functional Programming.

    Most of the time I have seen this goal is accomplished through you, the learner, having a technical problem or project (a real project ideally) that they can solve.

    Eventually your problems get more and more complex and you will naturally via good ol' Google come across an issue which may require you to start learning on this topic more. By then you will be able to pick it up with more confidence.

    Good rule of thumb: Ask yourself how all experts began in whatever field you are in. It's usually quite similar.

    submitted by /u/R_Illest
    [link] [comments]

    Looking for a specific type of learn aid or cheat sheet for android app development.

    Posted: 09 Nov 2018 10:58 PM PST

    As the title says, looking for a cheat sheet or flow chart for very basic steps in app development.

    I'm teaching myself and have read various books, follow tutorials, youtube....all the normal self taught stuff.

    But when I step out and try to make my own project app. I am immediately lost, and have to dig back through tons of material just to figure out get an adapter working....or something similar.

    What I'd love to find is a flow chart type thing that layed out the what is required to do or add certain basic steps

    Not how to write them, but more like a basic recipe for the components needed to do <something>.

    Does that make any sense?

    submitted by /u/Chknbone
    [link] [comments]

    Attention all gamers, in need of help for Python ;-;

    Posted: 09 Nov 2018 10:40 PM PST

    Freshman in high school, the first time taking a coding class and teacher assigned project. Quote: "make it challenging." Decided on making a game...clicker game to be specific, but open to changes. But the thing is...since I have no experience except for a few weeks of class, I have no idea where to start!

    Info found so far from research: Tkinter for buttons possibly Pygame and sounds?

    That's about it ;-;

    Anyone one made one? Link me to some helpful resources or outline the basics of how you went about making it, please?

    • Sincerely, me ('-') /
    submitted by /u/smileygonzo
    [link] [comments]

    Book I highly recommend: Understanding the Digital World - Brian W. Kernighan

    Posted: 09 Nov 2018 07:49 AM PST

    If you just started learning programming and want to know more about "the digital world" then this book is pretty awesome at explaining things in a very simple way.

    submitted by /u/Lesabotsy
    [link] [comments]

    Question about frameworks that can be used for web applications and mobile applications

    Posted: 09 Nov 2018 10:09 PM PST

    I am planning on developing a web application using Firebase.

    I intend on making my web application available to be downloaded on App Store or Play Store in the future.

    What is the best framework/programming language to create a web application with the intent of developing a mobile application later?

    submitted by /u/SaudiBeer
    [link] [comments]

    How do I convert an open source windows program into a Mac OSX program?

    Posted: 09 Nov 2018 09:56 PM PST

    I found this free and open source scriptwriting program (Trelby) that is only available for Windows 10 and Linux. The FAQ page says that a Mac OSX version of the program is possible but some developer "needs to make it." I have never really done programming before so I apologize if this is an obvious or dumb question, but I want to use this software on my Mac and I was wondering how complicated it would be to convert a program that I have the source code to into something that is Mac compatible and how long it would take. Is there a program out there that does it for you or do you basically have to restructure the entire software? Thanks!

    submitted by /u/OnoSideboard
    [link] [comments]

    Questions on Javascript & Functions

    Posted: 09 Nov 2018 11:16 AM PST

    In Javascript, there are several ways to create a function.

    You can declare the function as

    function foo(para) { return bar; } 

    You can use a lambda expression/anonymous function

    var foo = function(para) { return bar; } 

    You can use arrow syntax

    var foo = (para) => bar; 

    My questions are:

    • What are the differences between each function?
    • When & where are the best times to use each type of function?
    • What are the pros and cons of each type of function?

    While looking this up, I've found some people declare their functions whenever possible to make debugging easier, whereas others go out of their way to use arrow syntax whenever possible to automatically scope their functions.

    It's a bit difficult to compile all this information together, so I was hoping someone could explain this all to me.

    submitted by /u/RenariPryderi
    [link] [comments]

    How would I go about automating this?

    Posted: 09 Nov 2018 09:25 PM PST

    I want to write a script which does the following:

    • Remember books listed on here one by one.

    • Visit Ahem!Ahem!Library-Genesis

    • Search for an epub/mobi format as the first priority , pdf as a second , given that they are available.

    • Save that downloadable file onto my storage.

    How shall I go on about it ?

    submitted by /u/theotherguy00
    [link] [comments]

    [C++]How to create a 2D char array given a string?

    Posted: 09 Nov 2018 09:16 PM PST

    I'm working on a shortest path finding maze solver for my data structures and algorithms class. Given this string (or any string), how can I make a 2D array from it? That way, I can just loop through the 2d array and if its a whitespace, I can make a new vertex.

    For example, this

    "# ####\n# #\n# ## #\n# #\n### ##\n"

    should be stored in the 2D array like so:

    # ####

    # # # #

    # # # #

    ### ##

    submitted by /u/MisterJoz
    [link] [comments]

    Learning C++, want to best way to move forward.

    Posted: 09 Nov 2018 08:50 PM PST

    Uni student, I'm learning C++ at school and like it as it seems really complex and might take years to master. We're learning about classes at the moment but I can create some simple programs. I want to expand my skill set and do iOS development but don't know if I would be spreading myself too thin by trying to do a lot at once. I've looked a little into Swift but don't know if I should try to learn c++ better until I get comfortable enough to move onto something like swift right away... web development also seems interesting but I want to do something a little more design/ creativity.. This would also serve as a creative outlet for me... anyways any help/ advice is appreciated.

    submitted by /u/murphyisrich101
    [link] [comments]

    What main concepts do I need to know to get a job on Google?

    Posted: 09 Nov 2018 08:49 PM PST

    What are the main skills a software engineering need to have to be admitted on a job interview on Google ?

    submitted by /u/vinicius978
    [link] [comments]

    [C] Need a little help on a programming assignment

    Posted: 09 Nov 2018 04:51 PM PST

    I'm really new to programming, this is an intro to C course and we're doing data structures and stuff like that using pointers which I think is very difficult considering I've never learned C before and it's halfway through the semester.

    Here's the problem: https://imgur.com/a/fxBb5fT

    So far I've got this code but there's an "exit status -1" when I try and run it

    #include <stdio.h> #include <stdlib.h> struct Node { int value; struct Node * neighbors[50]; int num_neighbors; int visited; }; int dfs (struct Node * node) { int sum = node -> value; node -> visited = 1; for (int i = 0; i < node -> num_neighbors; i++) { if (node -> neighbors[i] -> visited == 0) { sum += dfs(node -> neighbors[i]); } return sum; } } int main() { int N; int M; int x; int i; scanf("%d", &N); scanf("%d", &M); printf("%d %d\n", N, M); struct Node * node[N]; for (i = 0; i < N; i++) { scanf("%d", &x); // printf("%d %d %d ", x, i, N); node[i] -> value = x; } if (node[i] -> visited == 0) { printf("%d", dfs(node[i])); } return 0; } 

    Can someone point me in the right direction, I'm really clueless and my friend helped me with most of what I have but he's not available anymore.

    submitted by /u/briceschooluf
    [link] [comments]

    How do I connect an app front end to a back end service?

    Posted: 09 Nov 2018 10:01 AM PST

    I'm starting to learn android programming, and I like to learn while doing, so I've picked a project to do. My question is, if I write a machine learning or some other type of program in the back end and want to connect that to an app, how do I do so? I know an app's front end controls the actual buttons and UX/UI, but how do I integrate that with my server side programs?

    For reference, I'll be writing android projects in eclipse (in Java) and a machine learning program in Python.

    Thanks for any guidance!

    submitted by /u/what_the_even_heck
    [link] [comments]

    Should I keep learning Python?

    Posted: 09 Nov 2018 04:31 PM PST

    Hi, I've been learning how to program by myself lately, also using Linux (Lubuntu distro) so that I can get acquainted with it, since I've read that it's the best OS for software development.

    Python has been a lot of fun so far, and as easy it is to use, I feel kind of disappointed about it because it is a script language, and I feel like I'm not actually learning how to program.

    C looks interesting but I fear that it might overcome my desire to program at all due to it being rather difficult, you know... I don't want to reinvent the wheel.

    submitted by /u/xdruppi
    [link] [comments]

    No comments:

    Post a Comment