reverse Questions

20

Solved

function reverseInPlace(str) { var words = []; words = str.split("\s+"); var result = ""; for (var i = 0; i < words.length; i++) { return result += words[i].split('').re...
Lamoreaux asked 19/3, 2018 at 10:26

1

Solved

Given we can do a left-rotate (and subsequently a right-rotate) of an array only in terms of calls to reverse, like so: void rotl(std::string &s, const int d) { std::reverse(s.begin() , s.begi...
Limekiln asked 18/9, 2024 at 8:32

11

Is there a function that reverses elements passed via pipeline? E.g.: PS C:\> 10, 20, 30 | Reverse 30 20 10
Expansion asked 31/3, 2014 at 20:39

2

Solved

I have a strings with pattern, something like this: (X,1,1,3),(X,1,1,3),(X,@2,@2,@2,@2,@2,(Y,1)) And I need to extract from this One big array, reverse order, and generate new string: (X,(Y,1),@2,...
Bernadinebernadotte asked 3/6, 2024 at 19:2

4

For example: My string is: 123456789 nn nn oo nn nn mlm nn203. My target is: nn. Then, I match string from the end to the beginning and return the first match result and its postion. In this examl...
Tenerife asked 12/5, 2013 at 17:13

19

I have an array of numbers that I am trying to reverse. I believe the function in my code is correct, but I cannot get the proper output. The output reads: 10 9 8 7 6. Why can't I get the other ha...
Butene asked 31/10, 2013 at 17:21

3

Solved

Current setup as follows: stream { server { listen 9987 udp; server_name subdomain.EXAMPLE.com; # this line is resulting in an error proxy_pass localhost:9987; proxy_timeout 1s; proxy_resp...
Merengue asked 21/7, 2017 at 1:18

34

Solved

Can anyone explain to me how to reverse an integer without using array or String. I got this code from online, but not really understand why + input % 10 and divide again. while (input != 0) { re...
Vowelize asked 27/9, 2010 at 17:13

6

Solved

now i'm trying to make reversed for a loop.The simple way of reverse for is for(i in start downTo end) but,what if I use array as a start/end point?
Seedcase asked 19/8, 2018 at 12:58

11

Solved

I want to replace characters at the end of a python string. I have this string: s = "123123" I want to replace the last 2 with x. Suppose there is a method called replace_last: >>&...
Claytor asked 9/9, 2010 at 9:24

12

Solved

So I have this function: function toAlpha($data){ $alphabet = array('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'); $alpha_flip = array_f...
Outlier asked 5/10, 2011 at 15:52

5

Solved

I've got a pandas DataFrame with a boolean column sorted by another column and need to calculate reverse cumulative sum of the boolean column, that is, amount of true values from current row to bot...
Ator asked 17/6, 2016 at 3:20

15

Can anyone tell me how to write a Java program to reverse a given sentence? For example, if the input is: "This is an interview question" The output must be: "question interview an is this...
Balaklava asked 26/4, 2010 at 13:14

10

Solved

I have a list of Python objects that I want to sort by a specific attribute of each object: [Tag(name="toe", count=10), Tag(name="leg", count=2), ...] How do I sort the list by...
Wherry asked 31/12, 2008 at 16:41

37

How can we reverse a simple string in Go?
Eastwards asked 17/11, 2009 at 22:44

5

Solved

I'm looking for a way to reverse a generator object. I know how to reverse sequences: foo = imap(seq.__getitem__, xrange(len(seq)-1, -1, -1)) But is something similar possible with a generator a...
Tartrazine asked 13/10, 2009 at 16:4

2

The first thing that comes to mind is: >>> l = list('abcdef') >>> for i in range(len(l)-1, -1, -1): ... item = l[i] ... print(i, item) ... 5 f 4 e 3 d 2 c 1 b 0 a I tried using t...
Brainchild asked 15/2, 2018 at 12:54

11

Solved

I have a String, and I would like to reverse it. For example, I am writing an AngularDart filter that reverses a string. It's just for demonstration purposes, but it made me wonder how I would reve...
Quatrefoil asked 3/2, 2014 at 7:18

16

Solved

I need to run through a List in reverse order using Java. So where this does it forwards: for(String string: stringList){ //...do something } Is there some way to iterate the stringList in rev...
Madiemadigan asked 8/7, 2009 at 13:34

7

Solved

I have a string containing space-delimited words. I want to reverse the letters in every word without reversing the order of the words. I would like my string to become ym gnirts.
Greathouse asked 23/7, 2009 at 6:32

0

I'm learning assembly and facing the following problem: In the function asm_func4: push rbp ; preserve rbp call _strlen ; get rdi strlen mov rdx, rax ; copy strlen to reverse counter sub...
Charleen asked 26/9, 2023 at 21:20

7

Solved

I thought I understood the basics of list slicing in python, but have been receiving an unexpected error while using a negative step on a slice, as follows: >>> a = list(range(10)) >&g...
Gormandize asked 2/1, 2017 at 17:15

24

Solved

How to reverse an array (in C#) without using Array.Reverse() method? For example, int[] arr = {1,3,4,9,8}; // some code here Console.WriteLine(string.Join(",", arr)); should result in 8,9,4,3...
Trinl asked 22/5, 2011 at 13:40

33

Solved

Given a dictionary like so: my_map = {'a': 1, 'b': 2} How can one invert this map to get: inv_map = {1: 'a', 2: 'b'}
Prevot asked 27/1, 2009 at 14:46

2

Solved

Suppose I have a vector v, how do I get its reverse, i.e. last element first? The first thing that comes to me is v[length(v):1], but it returns NA when v is numeric(0), while user normally expect...
Goldfish asked 21/9, 2013 at 13:58

© 2022 - 2025 — McMap. All rights reserved.