Hello,
Im working on a code challenge problem involving transforming a given binary matrix into another. I wrote the code in C++, and it works for the test cases i looked at, but it does not pass the online judge . The problem as well as my solution is at http://bit.ly/4SEoZ .
Can someone please tell me what could be going wrong ?
Than...
I just had an idea that I wonder whether is possible in java. Let's say when doing debugging using eclipse or netbeans, you could record an object and save it. Then when going through the second round of debugging, save the object again. Now you could compare the first object recorded with the second object for all properties and find ou...
Problem
This question actually came up at work today. We are planning an experiment where we will show a series of maps to users. Each map has 31 symbols on it. Each symbol also has a label. We noticed that, in a few cases, the labels overlapped, which rendered one of the labels unreadable.
We ended up identifying the problem symbols t...
How do you write your own function for finding the most accurate square root of an integer?
After googling it, I found this, but firstly, I didn't get it completely, and secondly, it is approximate too.
Assume square root as nearest integer (to the actual root) or a float.
...
The closure of a recent entertaining 'question' got me wondering what would have been a better forum for the challenge presented. I know there is a similar question, but most of the responses are pointers to infrequent and or hierarchical style challenges. I don't see any where the programming community creates both the challenges and ...
Ok this one is like my previous array searching challenge but with a twist.
You must build a function to search one 2d array (or suitable equivalent in your language) of 32-bit integers for another, and return the X and Y index that the second array exists within the first. If the second array does not completely and contiguously exist ...
How can one call a stored procedure for each row in a table, where the columns of a row are input parameters to the sp without using a Cursor?
...
USBCELL rechareable batteries - charged using the USB port
These came out a while back and are worth the money, in my opinion.
I searched around for software specifically made to monitor the battery level of USBCELL batteries and got nothing. There are some USB port monitor programs out there which might tie in somehow, but they could...
My task for you this time is to implement an insertion sort algorithm. Sure, everyone and his dog can do it; but how easy is it to do in the fewest characters? One must take an array (or suitable alternative in your language) of 32-bit integers and sort them by value via the insertion sort method, then return the sorted array as a copy ...
My entire team works from a different geographical location and I am the only programmer working remotely. I often find it quite difficult to have my code reviewed, as people take very long time to give their comments (usually they are genuinely busy with high priority work and I work mostly only on low priority projects/task ) .The com...
The Challenge
Write a program that acts as a Fractran interpreter. The shortest interpreter by character count, in any language, is the winner. Your program must take two inputs: The fractran program to be executed, and the input integer n. The program may be in any form that is convenient for your program - for example, a list of 2-tup...
I am trying to access a secure website through UIWebView. When I access it through safari, i get an authentication challenge but the same does not appear in my UIWebView in the application. How can I make it appear?
Any pointers, sample code or links will be very helpful. Thanks a lot.
...
Hi,
The point of this exercise is to make navigation between objects stateful.
For example, having Person and Address with 1-1 association it should:
If an address is assigned to a persons, then the person should be assigned to the address (and vice versa).
If address is assigned to person1 and then to person2, then the person1 wil...
2009-12-04 UPDATE: For profiling results on a number of the suggestions posted here, see below!
The Question
Consider the following very harmless, very straightforward method, which uses a switch statement to return a defined enum value:
public static MarketDataExchange GetMarketDataExchange(string ActivCode) {
if (ActivCode == ...
#!/usr/bin/python
import random
import string
appendToFile = open("appendedFile", "a" )
# Generator
for i in range(1, 100000):
chars = "".join( [random.choice(string.letters) for i in xrange(15)] )
chars2 = "".join( [random.choice(string.letters) for i in xrange(15)] )
appendToFile.write(chars + ":" + chars2 + "\n")
ap...
this is how i normally iterate a collection
for(Iterator iterator = collectionthing.iterator(); iterator.hasNext();){
I believe most of us doing this, I wonder is there any better approach than have to iterate sequentially? is there any java library..can I can make this parallel executed by multi-code cpu? =)
looking forward feedbac...
my service layer methods are transactional, when i use ExecutorService and submit task to threads, i cannot pass servicelayer as parameter to each threads, as i get error
Dec 14, 2009 10:40:18 AM com.companyx.applicationtest.applicationtestcompanyx.services.threadtestRunnable run
SEVERE: null
org.hibernate.HibernateException: No Hiberna...
The questions is: One small letter, surrounded by EXACTLY three big bodyguards on each of its sides.
I wrote this code and get an answer. I thougt it would be correct, but it doesn't work. Can anybody help me? My answer: KWGtIDC
import urllib, sys, string
from string import maketrans
bbb = 0
f = urllib.urlopen("http://www.pythonchalle...
I have recently started reading "Programming Challenges" book by S. Skiena and believe or not I am kind of stuck in the very first problem.
Here's a link to the problem: 3n+1 problem
Here's my code:
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
unsigned long calc(unsigned long n);
int main()
{
...
I was looking at this question and saw the reference to the iPhone game where you drag across the screen selecting letters as you go.
I was curious to see an implimentation of this in Javascript using tables. So you'd drag the mouse over each cell they would then become highlighted.
I'm not sure what the best method would be but I hope...