@khird @freemo It is pretty well cleaned up now. and I fleshed out the list a little to make it iterable and printable and stuff. Take a peek!
Please suggest one, just remember to include the hash tag
@khird @freemo It is pretty well cleaned up now. and I fleshed out the list a little to make it iterable and printable and stuff. Take a peek!
Please suggest one, just remember to include the hash tag
Second Freebie!!! This one is marked as "easy"
This problem was asked by Google.
Given two singly linked lists that intersect at some point, find the intersecting node. The lists are non-cyclical.
For example, given A = 3 -> 7 -> 8 -> 10 and B = 99 -> 1 -> 8 -> 10, return the node with value 8.
In this example, assume nodes with the same value are the exact same node objects.
Do this in O(M + N) time (where M and N are the lengths of the lists) and constant space.
The code isn't that bad, you just have to be careful you don't go down a dead end with your algorithm. It's much easier to add error checking etc. at the end if you designed a versatile solution than it is to try and generalise one of the more brittle ones.
Would you mind if I suggested a challenge? I have one involving graph manipulation, which is kind of up @freemo's alley.
Sorry been super busy but I will check it out soon.
Bobinas P4G is a social network. It runs on GNU social, version 2.0.1-beta0, available under the GNU Affero General Public License.
All Bobinas P4G content and data are available under the Creative Commons Attribution 3.0 license.