Questions tagged [reverse]

Rearranging the order of a sequence such that the final order is a mirror image of the original.

Rearranging the order of a sequence such that the final order is a mirror image of the original.

3773 questions
1
vote
2 answers

I don't know how to fix my reverse array/string

so I need to be able to enter a string and have it reversed. I must have one library JS file and one regular JS file. Here is my library JS file: function reverseString(string) { var reversedString= ""; for(var i = string.length -; i >=;…
Tori Volk
  • 11
  • 1
1
vote
1 answer

I am displaying contents of a java array in reverse order of input, but only half the array is being displayed

I'm doing a foundations course on Java, and the task is to create a program where a user inputs 10 strings into an array, the have the program display them back to the user in the reverse order of which they were input. Here is the relevant code so…
1
vote
2 answers

how to reverse strings in a batch file

I have three strings t1=3, t2=1 and t3=5. want to reverse these strings so that t1=5, t2=1 and t3=3. Together they form a number (input:315 and output:513). I need to reverse the number they form. I tried to do this: set "rest2=%t1%" set…
user4739322
1
vote
3 answers

python split and reverse text file

I have a text file which stores data like name : score e.g.: bob : 10 fred : 3 george : 5 However, I want to make it so it says 10 : bob 3 : fred 5 : george What would the code be to flip it like that? Would I need to separate them…
1
vote
3 answers

Reversing array logic in C not working properly

I am trying to read the input to my program (a string of chars) and invert the order of the words that are in it. For example, if I were to pass my program ABC DEF GHI JKL it would output JKL GHI DEF ABC. I am using the whitespace as separators. My…
Cesar A
  • 663
  • 1
  • 7
  • 10
1
vote
2 answers

Does for loop parameters execute each iteration?

At some point I wanted to randomize if an array would be inverted or not while creating it. One of the first things I figured was this: bool reverse = Random.value > 0.5f; for ( int i = reverse ? steps - 1 : 0; reverse ? i >= 0 : i…
Felipe Müller
  • 225
  • 1
  • 12
1
vote
2 answers

Django: How to write the reverse function for the following

The urlconf and view is as follows: url(r'^register/$', register, { 'backend': 'registration.backends.default.DefaultBackend' }, name='registration_register'), def register(request, backend, success_url=None, form_class=None, …
ninja123
  • 1,069
  • 1
  • 13
  • 21
1
vote
0 answers

Apache htaccess reverse proxy ends up in a 301 loop

I only have access to .htaccess, within which I'm adding a reverse proxy from a domain to a subdomain of that domain. Currently, my line is: RewriteRule ^blog(.*)$ http://blog.site.co.uk/$1 [P,L] The url www.site.co.uk/blog successfully gets the…
PaulG
  • 60
  • 8
1
vote
6 answers

C# Reverse a string array without using sort( ) or reverse( )

Hi I am trying to write a method that will reverse a string array onced called. I finished my code , but only get half of the array reversed, leaving the rest unchanged, being stuck on this for hours. so I had to ask on stack as last resort. …
Edward Sun
  • 183
  • 2
  • 12
1
vote
2 answers

JavaScript: How to reverse order=[] arrays from last to first?

My js code does POST order.php?order[]=1&order[]=2&order[]=3&order[]=4&order[]=5&&action=update How to reverse it to order.php?order[]=5&order[]=4&order[]=3&order[]=2&order[]=1&&action=update ? JavaScript: order=[]; //var reversed =…
Binyamin
  • 7,493
  • 10
  • 60
  • 82
1
vote
3 answers

Recursively reverse a stack

I need to reverse a stack using recursion in C++. I can only use pop, push, and reverseStack, no additional functions such as insertAtBottom which I've found while search stackoverflow and the web. I've tried: void Stack::reverseStack(){ if…
John Costanzo
  • 11
  • 1
  • 4
1
vote
1 answer

How to register OpenRCE?

When I register OpenRCE, it shows Too much spam, too little content. Find an admin for the 'secret' to complete registration if you really want. At some point, the site is going to get a complete refresh. and after click the register button, it…
卢古格
  • 11
  • 2
1
vote
3 answers

Reverse Part of a List

Take list foo foo = [5, 6, 7, 8, 9, 10, 11, 12] How can I reverse only the elements of indices x to y within the list? For example: x = 1 y = 5 # reverse foo[x:y] foo = [5, 9, 8, 7, 6, 10, 11, 12]
chambln
  • 363
  • 1
  • 2
  • 9
1
vote
2 answers

Can someone explain this code

There is this code for reversing a string .386 .model flat,stdcall .stack 4096 ExitProcess proto,dwExitCode:dword .data source BYTE "This is the source string",0 target BYTE SIZEOF source DUP('#') .code main PROC ; Point ESI to the last…
jake craigslist
  • 303
  • 3
  • 12
1
vote
1 answer

Having trouble writing program to reverse words in string in C

I'm trying to write a little program to reverse the words in a string (the classic interview question) but I'm hitting a bit of a snag. On another portion of the site, I came across a really cool way to reverse strings in place using bitwise…