careercup / ctci-6th-edition-csharp Goto Github PK
View Code? Open in Web Editor NEWCracking the Coding Interview 6th Ed. Solutions (C# Port)
Cracking the Coding Interview 6th Ed. Solutions (C# Port)
When I run the project for the first time, I get the following error.
System.ArgumentOutOfRangeException occurred
HResult=0x80131502
Message=The value must be greater than or equal to zero and less than the console's buffer size in that dimension.
Source=System.Console
StackTrace:
at System.ConsolePal.SetCursorPosition(Int32 left, Int32 top)
at System.Console.SetCursorPosition(Int32 left, Int32 top)
at ctci.Library.BTreePrinter.Print(String s, Int32 top, Int32 left, Int32 right) in C:\Repos\CrackingCodingInterview\ctci.Library\BTreePrinter.cs:line 93
at ctci.Library.BTreePrinter.Print(NodeInfo item, Int32 top) in C:\Repos\CrackingCodingInterview\ctci.Library\BTreePrinter.cs:line 76
at ctci.Library.BTreePrinter.Print(TreeNode root, Int32 topMargin, Int32 leftMargin) in C:\Repos\CrackingCodingInterview\ctci.Library\BTreePrinter.cs:line 54
at Chapter04.Q4_09_BST_Sequence.Run() in C:\Repos\CrackingCodingInterview\Ch 04. Trees\Q4 09 BST Sequence.cs:line 20
at ctci.Program.Main(String[] args) in C:\Repos\CrackingCodingInterview\ctci\Program.cs:line 101
I'm able to clone the repository. However when I try to open up the Solution file using Visual Studio 2015, I get the following errors. And none of the projects get loaded.
C:\Repos\CrackingCodingInterview\ctci.Contracts\ctci.Contracts.csproj : error : The default XML namespace of the project must be the MSBuild XML namespace. If the project is authored in the MSBuild 2003 format, please add xmlns="http://schemas.microsoft.com/developer/msbuild/2003" to the element. If the project has been authored in the old 1.0 or 1.2 format, please convert it to MSBuild 2003 format. C:\Repos\CrackingCodingInterview\ctci.Contracts\ctci.Contracts.csproj
C:\Repos\CrackingCodingInterview\ctci.Library\ctci.Library.csproj : error : The default XML namespace of the project must be the MSBuild XML namespace. If the project is authored in the MSBuild 2003 format, please add xmlns="http://schemas.microsoft.com/developer/msbuild/2003" to the element. If the project has been authored in the old 1.0 or 1.2 format, please convert it to MSBuild 2003 format. C:\Repos\CrackingCodingInterview\ctci.Library\ctci.Library.csproj
C:\Repos\CrackingCodingInterview\Introduction\Introduction.csproj : error : The default XML namespace of the project must be the MSBuild XML namespace. If the project is authored in the MSBuild 2003 format, please add xmlns="http://schemas.microsoft.com/developer/msbuild/2003" to the element. If the project has been authored in the old 1.0 or 1.2 format, please convert it to MSBuild 2003 format. C:\Repos\CrackingCodingInterview\Introduction\Introduction.csproj
C:\Repos\CrackingCodingInterview\ctci\ctci.csproj : error : The default XML namespace of the project must be the MSBuild XML namespace. If the project is authored in the MSBuild 2003 format, please add xmlns="http://schemas.microsoft.com/developer/msbuild/2003" to the element. If the project has been authored in the old 1.0 or 1.2 format, please convert it to MSBuild 2003 format. C:\Repos\CrackingCodingInterview\ctci\ctci.csproj
C:\Repos\CrackingCodingInterview\Ch 01. Arrays and Strings\Ch 01. Arrays and Strings.csproj : error : The default XML namespace of the project must be the MSBuild XML namespace. If the project is authored in the MSBuild 2003 format, please add xmlns="http://schemas.microsoft.com/developer/msbuild/2003" to the element. If the project has been authored in the old 1.0 or 1.2 format, please convert it to MSBuild 2003 format. C:\Repos\CrackingCodingInterview\Ch 01. Arrays and Strings\Ch 01. Arrays and Strings.csproj
C:\Repos\CrackingCodingInterview\Ch 05. Bit Manipulation\Ch 05. Bit Manipulation.csproj : error : The default XML namespace of the project must be the MSBuild XML namespace. If the project is authored in the MSBuild 2003 format, please add xmlns="http://schemas.microsoft.com/developer/msbuild/2003" to the element. If the project has been authored in the old 1.0 or 1.2 format, please convert it to MSBuild 2003 format. C:\Repos\CrackingCodingInterview\Ch 05. Bit Manipulation\Ch 05. Bit Manipulation.csproj
C:\Repos\CrackingCodingInterview\Ch 02. Linked Lists\Ch 02. Linked Lists.csproj : error : The default XML namespace of the project must be the MSBuild XML namespace. If the project is authored in the MSBuild 2003 format, please add xmlns="http://schemas.microsoft.com/developer/msbuild/2003" to the element. If the project has been authored in the old 1.0 or 1.2 format, please convert it to MSBuild 2003 format. C:\Repos\CrackingCodingInterview\Ch 02. Linked Lists\Ch 02. Linked Lists.csproj
C:\Repos\CrackingCodingInterview\Ch 10. Sorting and Searching\Ch 10. Sorting and Searching.csproj : error : The default XML namespace of the project must be the MSBuild XML namespace. If the project is authored in the MSBuild 2003 format, please add xmlns="http://schemas.microsoft.com/developer/msbuild/2003" to the element. If the project has been authored in the old 1.0 or 1.2 format, please convert it to MSBuild 2003 format. C:\Repos\CrackingCodingInterview\Ch 10. Sorting and Searching\Ch 10. Sorting and Searching.csproj
C:\Repos\CrackingCodingInterview\Ch 16. Moderate\Ch 16. Moderate.csproj : error : The default XML namespace of the project must be the MSBuild XML namespace. If the project is authored in the MSBuild 2003 format, please add xmlns="http://schemas.microsoft.com/developer/msbuild/2003" to the element. If the project has been authored in the old 1.0 or 1.2 format, please convert it to MSBuild 2003 format. C:\Repos\CrackingCodingInterview\Ch 16. Moderate\Ch 16. Moderate.csproj
C:\Repos\CrackingCodingInterview\Ch 04. Trees\Ch 04. Trees.csproj : error : The default XML namespace of the project must be the MSBuild XML namespace. If the project is authored in the MSBuild 2003 format, please add xmlns="http://schemas.microsoft.com/developer/msbuild/2003" to the element. If the project has been authored in the old 1.0 or 1.2 format, please convert it to MSBuild 2003 format. C:\Repos\CrackingCodingInterview\Ch 04. Trees\Ch 04. Trees.csproj
C:\Repos\CrackingCodingInterview\Introduction\Introduction.csproj : error : The default XML namespace of the project must be the MSBuild XML namespace. If the project is authored in the MSBuild 2003 format, please add xmlns="http://schemas.microsoft.com/developer/msbuild/2003" to the element. If the project has been authored in the old 1.0 or 1.2 format, please convert it to MSBuild 2003 format. C:\Repos\CrackingCodingInterview\Introduction\Introduction.csproj
C:\Repos\CrackingCodingInterview\ctci\ctci.csproj : error : The default XML namespace of the project must be the MSBuild XML namespace. If the project is authored in the MSBuild 2003 format, please add xmlns="http://schemas.microsoft.com/developer/msbuild/2003" to the element. If the project has been authored in the old 1.0 or 1.2 format, please convert it to MSBuild 2003 format. C:\Repos\CrackingCodingInterview\ctci\ctci.csproj
C:\Repos\CrackingCodingInterview\ctci.Contracts\ctci.Contracts.csproj : error : The default XML namespace of the project must be the MSBuild XML namespace. If the project is authored in the MSBuild 2003 format, please add xmlns="http://schemas.microsoft.com/developer/msbuild/2003" to the element. If the project has been authored in the old 1.0 or 1.2 format, please convert it to MSBuild 2003 format. C:\Repos\CrackingCodingInterview\ctci.Contracts\ctci.Contracts.csproj
There is a flaw in demo example for Question 1 Sorted Merge of Chapter 10 Sorting and Searching. The demo array that is supposed to be sorted as a pre-condition is not actually sorted. This leads to the fact that the demo result is not sorted as well.
See CtCI-6th-Edition-CSharp/Ch 10. Sorting and Searching/Q10_01_Sorted_Merge.cs
Line 42: int[] b = new int[] { 1, 4, 7, 6, 7, 7 };
See main issue at the link
Class: Q2_01_Remove_Dups.cs
Method: DeleteDupsA( )
Use of HashSet instead of Dictionary simplifies better in C#:
var table = new HashSet<int>();
Needed to change the Contains and Add methods below.
Class: Q1_01_Is_Unique.cs
Method: IsUniqueChars2( )
The question states:
you cannot use additional data structures
but in the second solution creates an array of boolean
var charSet = new bool[256];
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.