摘要: You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single 阅读全文
posted @ 2016-07-30 21:33 琴影 阅读(153) 评论(0) 推荐(0) 编辑
摘要: Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST. According to the definition of LCA on Wikipedia 阅读全文
posted @ 2016-07-30 20:42 琴影 阅读(291) 评论(0) 推荐(0) 编辑
摘要: The article describes an approach to solving the problem of finding the LCA of two nodes in a tree by reducing it to a RMQ problem. Lowest Common Ance 阅读全文
posted @ 2016-07-30 19:49 琴影 阅读(290) 评论(0) 推荐(0) 编辑
摘要: Given values of two nodes in a Binary Search Tree, write a c program to find the Lowest Common Ancestor (LCA). You may assume that both the values exi 阅读全文
posted @ 2016-07-30 19:45 琴影 阅读(119) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree (not a binary search tree) and two values say n1 and n2, write a program to find the least common ancestor. Following is definitio 阅读全文
posted @ 2016-07-30 19:27 琴影 阅读(302) 评论(0) 推荐(0) 编辑
摘要: B. One Bomb time limit per test:1 second memory limit per test:256 megabytes input:standard input output:standard output B. One Bomb time limit per te 阅读全文
posted @ 2016-07-30 11:59 琴影 阅读(310) 评论(0) 推荐(0) 编辑
摘要: 今天刷题遇到的问题:定义一个6*5的字符数组,用scanf一个一个的输入字符。 for(int i = 0; i < 6; i++) for(int j = 0; j < 5; j++){ scanf("%c", &a[i][j]); } 在界面上可以看到,当输入了5*5时,就结束了,原来回车的换行 阅读全文
posted @ 2016-07-30 11:36 琴影 阅读(3313) 评论(4) 推荐(0) 编辑
摘要: A. Launch of Collider time limit per test: 2 seconds memory limit per test: 256 megabytes input: standard input output: standard output A. Launch of C 阅读全文
posted @ 2016-07-30 09:45 琴影 阅读(228) 评论(0) 推荐(0) 编辑