Ok, so I have done the 'mathematical part' just I am not sure where to put them in and how to get them to return answers.
I'd appreciate if someone could help me with:
double maxProfit(double[] prices)
Suppose that the array prices contains the daily share price for a number of days. This method calculates the maximum possible profit that you could have made on this share if you had bought it on one of the days, and sold it on one of the later days. For example, suppose the prices are {10.80, 11.00, 10.50, 12.00, 14.00, 13.00}. Then if you have bought on day 0 and sold on day 5, you would have made $2.20. But if you bought on day 2 and sold on day 4 you would have made $3.50.
Not sure how to do this one, but I think that there's a need of loops.
(New to java, but know some knowledge from perl which helped me here)
How can I set up the profile for a use so when entering a eg first charachter of a file and then pressing the tab OS will complete the file name.
Thanks in advance Tom (4 Replies)
Hi all, This is my first post.
I am a complete noobie to the UNIX OS, I have an iMac G5 with the unix shell built in and am interested in learning how to use it to do things useful with it, but have no idea where to start. I have read over the basic commands but they haven't helped me much yet.... (3 Replies)
Hi All,
I need some help to complete the below script, after executing below script blank lines are coming, but i am expecting 4 digit numeric no. Please solve the issue ASAP.
function portno
{
while (true)
do
random=`echo $RANDOM | cut -c 1-4`
port=`netstat -a | grep -c $random`
... (5 Replies)
Hi,
Does anyone know how to make BASH provide a list of possible completions on the first tab, and then start cycling through the possibilites on the next tab?
Right now this is what I have in my .bashrc:
bind "set show-all-if-ambiguous on"
bind \\C-o:menu-complete
This allows... (0 Replies)
Hello Guys
I am a complete New bie in UNIX ( Just know a few of the commands ). Please guide how should I learn Unix In a proper way . I am doing a job, so i will have to do the study at home . Which books , Links, Pages you will suggest me so that i can learn UNIX fast .
Thanks (5 Replies)
I have the following piece of codes. Please explain it to me in great detail how are these codes working.
1. #include <stdio.h>
int main(){
int x;
x=0;
while (x<2 && fork()){
if (!fork()) execlp("echo","x++","x",0);
x++;
system("echo x+x");
}
}
2.
#include <stdio.h>
int i;... (1 Reply)
Discussion started by: prakashabii
1 Replies
7. Post Here to Contact Site Administrators and Moderators
In general, would most experts, moderators and programmers, like to see the original entire script (even if very long), or just a simplified version of the problematic parts?
I currently have a GNU bash function (with a lot of issues). Is it more advisable to make separate posts for each... (3 Replies)