└── README.md /README.md: -------------------------------------------------------------------------------- 1 | # What is that? 2 | 3 | ## New startup 4 | 5 | We're organizing a new company and would like you to join us. Therefore 6 | we're asking you to do a technical exercise. 7 | 8 | If you prefer to see some information about our new startup prior to solving 9 | technical exercises, no problem ;) I'll explain what the startup does in 10 | a few days. 11 | 12 | However, if you can blindly trust me and just do the exercise in the absence 13 | of any information about what it is we're doing, you're welcome to read the 14 | rest of the exercise :) 15 | 16 | ## Why do I think it is a good idea to ask people to do work without explaining why? 17 | 18 | I know I have a few thousand followers on Twitter and other social networks, 19 | many of them know me personally, and others kind of understand where I am 20 | coming from. 21 | 22 | My aim for the next few days is to see if there are some motivated engineers 23 | that would like to join us as one of the very first engineers of our 24 | new Silicon Valley startup. Startups are risky, but may be rewarding. 25 | Doing the technical exercise without full information is one of the smallest 26 | risks you can take in your life. 27 | 28 | If you aren't convinced now, no problem. There will be another chance later. 29 | With less risk. 30 | 31 | 32 | # Programming exercise for C/C++ engineers 33 | 34 | Ben, I need help! 35 | 36 | We're seeking strong C/C++ engineers with strong C/C++ skills who know C and/or C++ and can program by writing C or C++ code. 37 | 38 | * Do the exercise in your spare time. Do not use your current employer's equipment. 39 | * Leave your code on GitHub, BitBucket, or package it up in a `.tar.gz`. 40 | * Send a short note to [vlm@lionet.info](mailto:vlm@lionet.info) with a subject "C programmer assignment". Attach your resume, if you have it. 41 | * I expect your code to be self-contained and buildable on a reasonable recent unix system (such as Ubuntu 12+, CentOS 6+, FreeBSD 6+ or macOS X). If you're building on Windows OK too, just package it up neat in a way that doesn't require firing up Visual Studio. 42 | 43 | # Exercise 44 | 45 | You're asked to create a helper function that _normalizes_ strings containing 46 | filesystem paths. The file system is assumed to be unix, with slash-separated 47 | components. 48 | 49 | This function is going to be somewhat specialized for the webserver, so `domain.com/../foo` is expected to be equivalent to `domain.com/foo`. 50 | 51 | Examples of path normalization: 52 | 53 | | Path | Normalized | 54 | |-------------------|-------------------| 55 | | `../bar` | `/bar` | 56 | | `/foo/bar` | `/foo/bar` | 57 | | `/foo/bar/../baz` | `/foo/baz` | 58 | | `/foo/bar/./baz/` | `/foo/bar/baz/` | 59 | | `/foo/../../baz` | `/baz` | 60 | 61 | The solution that you are asked to write as part of this exercise should not touch the actual filesystem. 62 | The processing is done purely lexically on a string of bytes. 63 | Assume ASCII character encoding. 64 | 65 | The expected interface for the function is 66 | 67 | ```C 68 | char *normalize(const char *path); // Allocates memory. 69 | ``` 70 | 71 | or 72 | 73 | ```C++ 74 | std::string normalize(const std::string &path); 75 | ``` 76 | 77 | # Evaluation 78 | 79 | How will we assess your code: 80 | 81 | * We require bug-free code 82 | * We also very much enjoy reasonably fast code 83 | * Tests should be there 84 | 85 | Kudos if you can: 86 | * Avoid dependencies (such as boost-filesystem) 87 | * Explain cyclomatic complexity of the solution 88 | * Quantify the speed of the solution (for example, in Gbps per CPU core) 89 | * Assess the CPU cache effects 90 | 91 | The next steps will likely be for us to chat (in English or Russian) to see if there's a mutual fit. 92 | --------------------------------------------------------------------------------